@miracle352/statute 0.0.0-stage → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +319 -2
  3. package/action.yml +356 -0
  4. package/bin/hook.js +81 -0
  5. package/bin/init.js +142 -0
  6. package/bin/mcp.js +166 -0
  7. package/bin/scope.js +78 -0
  8. package/bin/shots.js +52 -0
  9. package/bin/statute.js +362 -0
  10. package/examples/expect/newsletter_test.md +22 -0
  11. package/examples/expect/output-newsletter/.internal/execution.json +2053 -0
  12. package/examples/expect/output-newsletter/.internal/meta.json +39 -0
  13. package/examples/expect/output-newsletter/.internal/steps/1-d2368411/flows/0/actions.ndjson +2 -0
  14. package/examples/expect/output-newsletter/.internal/steps/2-a9e761f8/flows/0/actions.ndjson +6 -0
  15. package/examples/expect/output-newsletter/.internal/steps/3-63305a01/flows/0/actions.ndjson +2 -0
  16. package/examples/expect/output-newsletter/Result.md +21 -0
  17. package/examples/expect/search_test.md +20 -0
  18. package/laws/README.md +24 -0
  19. package/laws/accept_still_works_test.md +12 -0
  20. package/laws/cancel_as_easy_as_signup_test.md +15 -0
  21. package/laws/output-reject_means_reject/.internal/execution.json +1279 -0
  22. package/laws/output-reject_means_reject/.internal/meta.json +18 -0
  23. package/laws/output-reject_means_reject/.internal/steps/1-567cc234/flows/0/actions.ndjson +6 -0
  24. package/laws/output-reject_means_reject/.internal/steps/2-e3c06462/flows/0/actions.ndjson +1 -0
  25. package/laws/output-reject_means_reject/.internal/steps/3-3040a29b/flows/0/actions.ndjson +2 -0
  26. package/laws/output-reject_means_reject/Result.md +21 -0
  27. package/laws/price_shown_is_price_paid_test.md +12 -0
  28. package/laws/reject_means_reject_test.md +15 -0
  29. package/package.json +65 -4
  30. package/replays/cancel-demo-shop/evidence/cancel-1794754943192.evidence +0 -0
  31. package/replays/cancel-demo-shop/evidence/cancel-1794755110410.evidence +0 -0
  32. package/replays/cancel-demo-shop/loop.json +32 -0
  33. package/replays/demo-shop/evidence/consent-1794751413210.evidence +0 -0
  34. package/replays/demo-shop/evidence/consent-1794751523524.evidence +0 -0
  35. package/replays/demo-shop/evidence/consent-accept-1794751588395.evidence +0 -0
  36. package/replays/demo-shop/loop.json +40 -0
  37. package/replays/haxcms/evidence/consent-1794831086682.evidence +0 -0
  38. package/replays/haxcms/evidence/consent-1794831262757.evidence +0 -0
  39. package/replays/haxcms/evidence/consent-accept-1794831347132.evidence +0 -0
  40. package/replays/haxcms/loop.json +56 -0
  41. package/replays/in-the-wake-check/consent.json +67 -0
  42. package/replays/in-the-wake-check/consent.md +32 -0
  43. package/replays/kane-testmd-demo-shop/evidence/consent-1794935266000.evidence +0 -0
  44. package/replays/kane-testmd-demo-shop/loop.json +18 -0
  45. package/replays/lumen-pr-2/evidence/consent-1794929771799.evidence +0 -0
  46. package/replays/lumen-pr-2/evidence/consent-1794929845913.evidence +0 -0
  47. package/replays/lumen-pr-2/evidence/consent-accept-1794929886905.evidence +0 -0
  48. package/replays/lumen-pr-2/loop.json +57 -0
  49. package/replays/newsletter-expect/evidence/newsletter_test-round1-1795518837738.evidence +0 -0
  50. package/replays/newsletter-expect/evidence/newsletter_test-round2-1795519079029.evidence +0 -0
  51. package/replays/newsletter-expect/loop.json +99 -0
  52. package/replays/price-demo-shop/evidence/price-1794837093949.evidence +0 -0
  53. package/replays/price-demo-shop/evidence/price-1794837311639.evidence +0 -0
  54. package/replays/price-demo-shop/loop.json +43 -0
  55. package/rules/trackers.json +61 -0
  56. package/site/assets/fonts/OFL-archivo.txt +93 -0
  57. package/site/assets/fonts/OFL-geist.txt +93 -0
  58. package/site/assets/fonts/OFL-instrument-serif.txt +93 -0
  59. package/site/assets/fonts/archivo.woff2 +0 -0
  60. package/site/assets/fonts/geist.woff2 +0 -0
  61. package/site/assets/fonts/instrument-serif-italic.woff2 +0 -0
  62. package/site/assets/fonts/instrument-serif.woff2 +0 -0
  63. package/site/assets/fonts/inter.woff2 +0 -0
  64. package/site/assets/fonts/jetbrains-mono.woff2 +0 -0
  65. package/skill/statute/SKILL.md +57 -0
  66. package/src/agent.js +70 -0
  67. package/src/app.js +41 -0
  68. package/src/evidence.js +80 -0
  69. package/src/expect-cli.js +296 -0
  70. package/src/expect-view.js +79 -0
  71. package/src/expect.js +392 -0
  72. package/src/infer.js +32 -0
  73. package/src/kane.js +124 -0
  74. package/src/pack.js +128 -0
  75. package/src/packs/cancel.js +83 -0
  76. package/src/packs/consent-accept.js +57 -0
  77. package/src/packs/consent.js +237 -0
  78. package/src/packs/price.js +104 -0
  79. package/src/page.js +360 -0
  80. package/src/report.js +59 -0
  81. package/src/zip.js +38 -0
@@ -0,0 +1,99 @@
1
+ {
2
+ "title": "Kane CLI test examples/expect/newsletter_test.md on the Lumen demo shop: Kane passed, Statute found the email leak, Claude Code fixed it, Kane and Statute proved the fix",
3
+ "pack": "expect",
4
+ "test": "examples/expect/newsletter_test.md",
5
+ "url": "http://localhost:4173/",
6
+ "source": "statute expect examples/expect/newsletter_test.md --url http://localhost:4173/ --fix --app demo-store (real Kane CLI 0.10.8 runs and a real Claude Code fix, on a local copy of the demo shop)",
7
+ "timeline": [
8
+ {
9
+ "round": 1,
10
+ "step": "kane",
11
+ "verdict": "violation",
12
+ "why": "2 expectations broken: text \"jane.doe@example.com\" never leaves this site; what was typed in \"Sign up for the newsletter\" never leaves this site.",
13
+ "kaneStatus": "passed",
14
+ "evidence": "evidence/newsletter_test-round1-1795518837738.evidence",
15
+ "results": [
16
+ {
17
+ "rule": "text \"jane.doe@example.com\" never leaves this site",
18
+ "status": "fail",
19
+ "detail": "the value reached www.google-analytics.com (URL-encoded)",
20
+ "evidence": [
21
+ {
22
+ "host": "www.google-analytics.com",
23
+ "url": "www.google-analytics.com/g/collect",
24
+ "how": "URL-encoded",
25
+ "value": "jane.doe@example.com"
26
+ }
27
+ ]
28
+ },
29
+ {
30
+ "rule": "what was typed in \"Sign up for the newsletter\" never leaves this site",
31
+ "status": "fail",
32
+ "detail": "what was typed in \"Sign up for the newsletter\" reached 1 other host: www.google-analytics.com (URL-encoded)",
33
+ "evidence": [
34
+ {
35
+ "host": "www.google-analytics.com",
36
+ "url": "www.google-analytics.com/g/collect",
37
+ "how": "URL-encoded",
38
+ "value": "jane.doe@example.com"
39
+ }
40
+ ]
41
+ },
42
+ {
43
+ "rule": "no server errors",
44
+ "status": "pass",
45
+ "detail": "no 5xx in 19 requests"
46
+ },
47
+ {
48
+ "rule": "no failed requests to this site",
49
+ "status": "pass",
50
+ "detail": "every request to localhost succeeded"
51
+ }
52
+ ],
53
+ "at": "2026-11-24T11:13:57.766Z"
54
+ },
55
+ {
56
+ "round": 1,
57
+ "step": "agent",
58
+ "agent": "claude-code",
59
+ "summary": "What was wrong: `tags.js` loaded Google Analytics and the Meta pixel on every page as soon as it loaded, before the visitor chose anything and even after \"Reject all\". The banner only saved the choice and hid itself.\n\nWhat I changed: `public/tags.js` now reads the consent cookie on every page and adds the tags only when it says \"accepted\". `public/consent.js` loads them right away when someone clicks \"Accept all\", so analytics still works after Accept. Both files pass `node --check`; I haven't run it in a browser, so Kane's re-check will confirm it.",
60
+ "changed": [
61
+ "public/consent.js",
62
+ "public/tags.js",
63
+ "server.js"
64
+ ],
65
+ "at": "2026-11-24T11:17:08.202Z"
66
+ },
67
+ {
68
+ "round": 2,
69
+ "step": "kane",
70
+ "verdict": "pass",
71
+ "why": "All 4 expectations held.",
72
+ "kaneStatus": "passed",
73
+ "evidence": "evidence/newsletter_test-round2-1795519079029.evidence",
74
+ "results": [
75
+ {
76
+ "rule": "text \"jane.doe@example.com\" never leaves this site",
77
+ "status": "pass",
78
+ "detail": "the value stayed on localhost"
79
+ },
80
+ {
81
+ "rule": "what was typed in \"Sign up for the newsletter\" never leaves this site",
82
+ "status": "pass",
83
+ "detail": "1 typed value stayed on localhost"
84
+ },
85
+ {
86
+ "rule": "no server errors",
87
+ "status": "pass",
88
+ "detail": "no 5xx in 19 requests"
89
+ },
90
+ {
91
+ "rule": "no failed requests to this site",
92
+ "status": "pass",
93
+ "detail": "every request to localhost succeeded"
94
+ }
95
+ ],
96
+ "at": "2026-11-24T11:17:59.045Z"
97
+ }
98
+ ]
99
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "pack": "price",
3
+ "url": "http://localhost:4173",
4
+ "app": "demo-store",
5
+ "strict": true,
6
+ "timeline": [
7
+ {
8
+ "round": 1,
9
+ "step": "kane",
10
+ "pack": "price",
11
+ "verdict": "violation",
12
+ "why": "Kane read the prices: the product page showed \u20ac49.00 and the checkout total was \u20ac53.99. The checkout listed Service fee \u2014 4.99. Apart from shipping and tax, 4.99 more than the shown price was added at checkout (Service fee \u2014).",
13
+ "run": "https://test-manager.lambdatest.com/projects/01M7E4JR87M8V8X3PY5SPEP2E6/test-cases/01M7J9W85TNF386QH2VY1KNQCM/dashboard/share/US_3OSKAIFMOWW9YZYRBMV99K5R8C8ZN71ILHVHDR0MEEVFCVIVHXI23K6GZ9J8LGGH?type=summary&agentView=true&fqdn=summary-page",
14
+ "evidence": "evidence/price-1794837093949.evidence",
15
+ "credits": 40.50791250000001,
16
+ "kaneStatus": "passed",
17
+ "kaneSummary": "You asked to open the first product, add it to the cart, and proceed to checkout without paying.\nA cookie banner appeared and all cookies were rejected.\nThe first product was opened; its listed price was \u20ac49.00.\nThe product was added to the cart and checkout was reached, stopping before payment.\nThe checkout total is \u20ac53.99, including a Service fee of \u20ac4.99.",
18
+ "at": "2026-11-16T13:51:34.550Z"
19
+ },
20
+ {
21
+ "round": 1,
22
+ "step": "agent",
23
+ "agent": "claude-code",
24
+ "summary": "Problem: `server.js` added a \u20ac4.99 \"Service fee\" only at checkout, so the \u20ac49.00 product price turned into \u20ac53.99 at the last step.\n\nFix: I removed the hidden fee (the `SERVICE_FEE` constant and its checkout line), so checkout now totals \u20ac49.00, the same as the product page and cart. `node --check` passes; I haven't re-run the Kane check.",
25
+ "at": "2026-11-16T13:52:04.391Z"
26
+ },
27
+ {
28
+ "round": 2,
29
+ "step": "kane",
30
+ "pack": "price",
31
+ "verdict": "pass",
32
+ "why": "Kane read the prices: the product page showed \u20ac49.00 and the checkout total was \u20ac49.00. Apart from shipping and tax, the shopper pays the price they were shown.",
33
+ "run": "https://test-manager.lambdatest.com/projects/01M7E4JR87M8V8X3PY5SPEP2E6/test-cases/01M7JA2BXGW918DSW7ZAY84FR9/dashboard/share/US_RG2Q79RQ697NKGPMVB186IBFL2IIUPNYO7FHVW8I2NKESU01TUKL2WC0PWK5BLA0?type=summary&agentView=true&fqdn=summary-page",
34
+ "evidence": "evidence/price-1794837311639.evidence",
35
+ "credits": 37.3534525,
36
+ "kaneStatus": "passed",
37
+ "kaneSummary": "You asked to open the first product, add it to the cart, and proceed to checkout without making a payment.\nA cookie banner appeared and its cookies were rejected.\nThe first product, Halo Desk Lamp, was opened; its displayed price was \u20ac49.00.\nThe product was added to the cart and checkout was opened.\nThe run stopped on the checkout review page before payment. The total to pay was \u20ac49.00, with no additional lines listed between the product and the total.",
38
+ "at": "2026-11-16T13:55:12.229Z"
39
+ }
40
+ ],
41
+ "credits": 77.861365,
42
+ "title": "Lumen demo shop: Kane finds a fee that only appears at checkout; Claude Code removes it; Kane proves the shopper pays the price shown"
43
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "note": "Curated subset of well-known advertising and analytics endpoints (from the public Disconnect and DuckDuckGo Tracker Radar lists). Only these count as trackers; an ordinary cookie never does.",
3
+ "domains": [
4
+ "googletagmanager.com",
5
+ "google-analytics.com",
6
+ "analytics.google.com",
7
+ "doubleclick.net",
8
+ "googleadservices.com",
9
+ "googlesyndication.com",
10
+ "connect.facebook.net",
11
+ "facebook.com/tr",
12
+ "bat.bing.com",
13
+ "clarity.ms",
14
+ "analytics.tiktok.com",
15
+ "snap.licdn.com",
16
+ "px.ads.linkedin.com",
17
+ "static.hotjar.com",
18
+ "script.hotjar.com",
19
+ "cdn.segment.com",
20
+ "api.segment.io",
21
+ "cdn.mxpnl.com",
22
+ "api-js.mixpanel.com",
23
+ "sc-static.net",
24
+ "ct.pinterest.com",
25
+ "s.pinimg.com",
26
+ "ads-twitter.com",
27
+ "static.ads-twitter.com",
28
+ "criteo.com",
29
+ "criteo.net",
30
+ "taboola.com",
31
+ "outbrain.com",
32
+ "amazon-adsystem.com",
33
+ "adnxs.com",
34
+ "quantserve.com",
35
+ "scorecardresearch.com"
36
+ ],
37
+ "cookies": [
38
+ "^_ga$",
39
+ "^_ga_",
40
+ "^_gid$",
41
+ "^_gat",
42
+ "^_gcl_",
43
+ "^_fbp$",
44
+ "^_fbc$",
45
+ "^fr$",
46
+ "^IDE$",
47
+ "^test_cookie$",
48
+ "^_uetsid$",
49
+ "^_uetvid$",
50
+ "^_clck$",
51
+ "^_clsk$",
52
+ "^_ttp$",
53
+ "^_tt_enable_cookie$",
54
+ "^li_fat_id$",
55
+ "^_hj",
56
+ "^mp_",
57
+ "^ajs_anonymous_id$",
58
+ "^_pin_unauth$",
59
+ "^_scid"
60
+ ]
61
+ }
@@ -0,0 +1,93 @@
1
+ Copyright 2020 The Archivo Project Authors (https://github.com/Omnibus-Type/Archivo) Archivo-Italic[wdth,wght].ttf: Copyright 2020 The Archivo Project Authors (https://github.com/Omnibus-Type/Archivo)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,93 @@
1
+ Copyright 2024 The Geist Project Authors (https://github.com/vercel/geist-font) Geist-Italic[wght].ttf: Copyright 2024 The Geist Project Authors (https://github.com/vercel/geist-font)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,93 @@
1
+ Copyright 2022 The Instrument Serif Project Authors (https://github.com/Instrument/instrument-serif) InstrumentSerif-Italic.ttf: Copyright 2022 The Instrument Serif Project Authors (https://github.com/Instrument/instrument-serif)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file
Binary file
Binary file
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: statute
3
+ description: Use after changing anything that touches analytics or ad tags, cookie or consent banners, prices, fees or checkout totals, or subscriptions and cancellation. Kane CLI checks the running app against consumer law in a real browser and code judges the evidence; do not call the work done until it passes.
4
+ ---
5
+
6
+ # Statute: prove the change is legal before calling it done
7
+
8
+ Functional tests can't see these bugs: the page works, and it still breaks the law. Statute sends Kane CLI to use the app like a visitor and judges what Kane recorded with code, not a model.
9
+
10
+ ## When to run it
11
+
12
+ Run the matching check after any change that touches:
13
+
14
+ | The change touches | Check |
15
+ |---|---|
16
+ | analytics or ad tags (gtag, Google Tag Manager, Meta pixel, TikTok, LinkedIn, Clarity, Hotjar), cookies, a consent banner | `consent` |
17
+ | product prices, fees, surcharges, cart or checkout totals | `price` |
18
+ | subscribing, plans, renewals, cancelling | `cancel` |
19
+
20
+ If you are unsure, `npx -y @miracle352/statute` lists the checks. A change to styling or copy alone needs none.
21
+
22
+ ## How
23
+
24
+ 1. Start nothing yourself. Statute starts the app, sends Kane, and stops the app:
25
+
26
+ ```bash
27
+ npx -y @miracle352/statute check consent --url http://localhost:3000 --start "npm start"
28
+ ```
29
+
30
+ Use the project's real start command and port. For a deployed preview, pass its URL and leave out `--start`.
31
+
32
+ 2. Read the exit code and the report it prints (also saved to `statute-report/<check>.md`):
33
+ - `0` pass: say so, and quote the one-line verdict.
34
+ - `1` violation: the report names every tracker request, fee or extra cancel step Kane recorded, and how to fix it. Fix exactly that.
35
+ - `3` not judged: Kane could not finish or was not installed. Tell the user; do not report a pass.
36
+
37
+ 3. After a fix, run the same check again. For `consent`, also run `consent-accept`: the fix must keep the tags working after Accept, so removing analytics is not a fix.
38
+
39
+ 4. You are done only when the check passes. Never describe a fix as working before Kane has passed it.
40
+
41
+ To let Statute run the whole loop itself (Kane finds it, you fix it, Kane proves it, up to three rounds):
42
+
43
+ ```bash
44
+ npx -y @miracle352/statute fix consent --url http://localhost:3000 --start "npm start" --app .
45
+ ```
46
+
47
+ ## Already have a sealed Kane pack?
48
+
49
+ Kane CLI test files for each law are in the Statute repository (`laws/*_test.md`). After `kane-cli testmd run ...`, judge the newest pack with no new run:
50
+
51
+ ```bash
52
+ npx -y @miracle352/statute judge consent --latest
53
+ ```
54
+
55
+ ## Needs
56
+
57
+ Node 22 and Kane CLI (`npm install -g @testmuai/kane-cli`, then `kane-cli login`, or `LT_USERNAME` and `LT_ACCESS_KEY` set). Each check costs about 20 to 40 Kane credits.
package/src/agent.js ADDED
@@ -0,0 +1,70 @@
1
+ // Hands a Statute report to a coding agent (Claude Code, headless) and lets it fix the app.
2
+ const { spawn } = require("child_process");
3
+
4
+ function prompt({ pack, reportMd, appDir }) {
5
+ return [
6
+ `Statute ran Kane CLI against this app and found a compliance violation: "${pack.title}".`,
7
+ `Rule: ${pack.rule}`,
8
+ "",
9
+ "Fix the app's source code so the rule holds. Requirements:",
10
+ "- Work only inside the current folder (the app). Do not touch any statute-report files.",
11
+ "- Make the smallest change that fixes the root cause. Do not delete analytics or ads entirely:",
12
+ " after the visitor clicks Accept, the tags must still load.",
13
+ "- The check runs in a fresh browser with no cookies, so behaviour on first visit matters.",
14
+ "- You may run `node --check <file>` to syntax-check JavaScript you changed.",
15
+ "- When you are done, reply with two short lines: what was wrong, what you changed.",
16
+ "",
17
+ `App folder: ${appDir}`,
18
+ "",
19
+ "Here is Statute's report, based on what Kane recorded in a real browser:",
20
+ "",
21
+ reportMd,
22
+ ].join("\n");
23
+ }
24
+
25
+ // Runs `claude -p` with the prompt on stdin. Returns Claude's final text.
26
+ function fix({ pack, reportMd, appDir, onLine, text }) {
27
+ return new Promise((resolve, reject) => {
28
+ const cmd = "claude -p --permission-mode acceptEdits --allowedTools Read,Edit,Write,Glob,Grep \"Bash(node --check:*)\"";
29
+ const child = spawn(cmd, { cwd: appDir, shell: true, stdio: ["pipe", "pipe", "pipe"] });
30
+ let out = "";
31
+ let err = "";
32
+ child.stdout.on("data", (d) => {
33
+ out += d;
34
+ if (onLine) for (const l of String(d).split("\n")) if (l.trim()) onLine(l);
35
+ });
36
+ child.stderr.on("data", (d) => (err += d));
37
+ child.on("error", reject);
38
+ child.on("close", (code) => {
39
+ const said = (out + "\n" + err).trim();
40
+ // A failed sign-in or a crash is not a fix, whatever Claude printed.
41
+ if (code !== 0 || /failed to authenticate|not logged in|invalid api key|please run .?claude (auth )?login|credit balance is too low/i.test(said)) {
42
+ return reject(new Error(`Claude Code did not run (exit ${code}): ${said.slice(-600)}`));
43
+ }
44
+ resolve(out.trim());
45
+ });
46
+ child.stdin.end(text || prompt({ pack, reportMd, appDir }));
47
+ });
48
+ }
49
+
50
+ // For test files with expectations: the broken expectations are the brief.
51
+ function promptExpect({ reportMd, appDir, testName }) {
52
+ return [
53
+ `Statute ran the Kane CLI test "${testName}" against this app. Kane's steps ran, but the page broke expectations that Statute checked in Kane's recorded evidence (network traffic, cookies, console, values).`,
54
+ "",
55
+ "Fix the app's source code so every expectation holds. Requirements:",
56
+ "- Work only inside the current folder (the app). Do not touch the test file or any statute-report files.",
57
+ "- Fix the root cause, keep the feature working: the same steps must still succeed for a real user.",
58
+ "- Do not switch off analytics or other features to make a rule pass unless the rule asks for that.",
59
+ "- You may run `node --check <file>` to syntax-check JavaScript you changed.",
60
+ "- When you are done, reply with two short lines: what was wrong, what you changed.",
61
+ "",
62
+ `App folder: ${appDir}`,
63
+ "",
64
+ "Statute's report:",
65
+ "",
66
+ reportMd,
67
+ ].join("\n");
68
+ }
69
+
70
+ module.exports = { fix, prompt, promptExpect };