@codyswann/lisa 4.101.4 → 4.101.6

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 (110) hide show
  1. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  2. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  3. package/dist/core/upstream-evidence-manifest.js +24 -5
  4. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  5. package/dist/opencode/hooks-installer.d.ts.map +1 -1
  6. package/dist/opencode/hooks-installer.js +8 -0
  7. package/dist/opencode/hooks-installer.js.map +1 -1
  8. package/dist/opencode/plugin-catalog.d.ts.map +1 -1
  9. package/dist/opencode/plugin-catalog.js +5 -0
  10. package/dist/opencode/plugin-catalog.js.map +1 -1
  11. package/dist/opencode/plugin-templates/block-host-name-leak.mjs +511 -0
  12. package/dist/opencode/plugin-templates/block-host-name-leak.sh +69 -0
  13. package/dist/opencode/plugin-templates/host-name-command-context.mjs +455 -0
  14. package/dist/opencode/plugin-templates/lisa-block-host-name-leak.ts +62 -0
  15. package/package.json +4 -4
  16. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  17. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  18. package/plugins/lisa/.codex-plugin/scripts/automation-run-record.mjs +678 -0
  19. package/plugins/lisa/.codex-plugin/scripts/blocker-edge-resolution.mjs +150 -0
  20. package/plugins/lisa/.codex-plugin/scripts/intake-blocker-reprobe.mjs +1379 -0
  21. package/plugins/lisa/.codex-plugin/scripts/intake-prework-denominator.mjs +249 -0
  22. package/plugins/lisa/.codex-plugin/scripts/operator-id-kinds.mjs +120 -0
  23. package/plugins/lisa/.codex-plugin/scripts/qa-signal-lifecycle.mjs +523 -0
  24. package/plugins/lisa/.codex-plugin/scripts/ready-queue-order.mjs +549 -0
  25. package/plugins/lisa/.codex-plugin/scripts/resolve-lifecycle-role.mjs +347 -0
  26. package/plugins/lisa/hooks/block-host-name-leak.mjs +11 -5
  27. package/plugins/lisa/hooks/host-name-command-context.mjs +45 -2
  28. package/plugins/lisa-agy/hooks/block-host-name-leak.mjs +11 -5
  29. package/plugins/lisa-agy/hooks/host-name-command-context.mjs +45 -2
  30. package/plugins/lisa-agy/plugin.json +1 -1
  31. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  32. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  33. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  34. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  35. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  36. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  37. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  38. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  39. package/plugins/lisa-copilot/hooks/block-host-name-leak.mjs +11 -5
  40. package/plugins/lisa-copilot/hooks/host-name-command-context.mjs +45 -2
  41. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  42. package/plugins/lisa-cursor/hooks/block-host-name-leak.mjs +11 -5
  43. package/plugins/lisa-cursor/hooks/host-name-command-context.mjs +45 -2
  44. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  45. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  46. package/plugins/lisa-devin/hooks/block-host-name-leak.mjs +11 -5
  47. package/plugins/lisa-devin/hooks/host-name-command-context.mjs +45 -2
  48. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  49. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  50. package/plugins/lisa-expo-agy/plugin.json +1 -1
  51. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  52. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  53. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  54. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  55. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  56. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  57. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  58. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  59. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  60. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  61. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  62. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  63. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  64. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  65. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  66. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  67. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  68. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  69. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  70. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  71. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  72. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  73. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  74. package/plugins/lisa-openclaw-devin/.claude-plugin/plugin.json +1 -1
  75. package/plugins/lisa-openclaw-devin/.devin-plugin/plugin.json +1 -1
  76. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  77. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  78. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  79. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  80. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  81. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  82. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  83. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  84. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  85. package/plugins/lisa-rails-agy/plugin.json +1 -1
  86. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  87. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  88. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  89. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  90. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  91. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  92. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  93. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  94. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  95. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  96. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  97. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  98. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  99. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  100. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  101. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  102. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  103. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  104. package/plugins/src/base/hooks/block-host-name-leak.mjs +11 -5
  105. package/plugins/src/base/hooks/host-name-command-context.mjs +45 -2
  106. package/scripts/copy-opencode-plugin-templates.mjs +3 -0
  107. package/scripts/generate-codex-plugin-artifacts.mjs +6 -0
  108. package/scripts/lib/codex-shared-scripts.mjs +156 -0
  109. package/scripts/lib/host-name-launcher-cases.mjs +280 -0
  110. package/scripts/verify-host-name-target-scope.mjs +9 -0
@@ -1 +1 @@
1
- {"version":3,"file":"hooks-installer.d.ts","sourceRoot":"","sources":["../../src/opencode/hooks-installer.ts"],"names":[],"mappings":"AA4CA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOrD,gFAAgF;AAChF,eAAO,MAAM,sBAAsB,WAAW,CAAC;AAE/C,sEAAsE;AACtE,eAAO,MAAM,wBAAwB,kBAAkB,CAAC;AAKxD,wEAAwE;AACxE,eAAO,MAAM,0BAA0B,eAAe,CAAC;AAEvD,2EAA2E;AAC3E,eAAO,MAAM,gCAAgC,oCAAoE,CAAC;AAyDlH,gDAAgD;AAChD,MAAM,WAAW,0BAA0B;IACzC,uEAAuE;IACvE,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,mEAAmE;IACnE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,6EAA6E;IAC7E,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,SAAS,WAAW,EAAE,EACrC,oBAAoB,EAAE,SAAS,MAAM,EAAE,GACtC,OAAO,CAAC,0BAA0B,CAAC,CAyDrC;AAgGD;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAyCpE;AAiGD;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAa5B"}
1
+ {"version":3,"file":"hooks-installer.d.ts","sourceRoot":"","sources":["../../src/opencode/hooks-installer.ts"],"names":[],"mappings":"AAiDA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOrD,gFAAgF;AAChF,eAAO,MAAM,sBAAsB,WAAW,CAAC;AAE/C,sEAAsE;AACtE,eAAO,MAAM,wBAAwB,kBAAkB,CAAC;AAKxD,wEAAwE;AACxE,eAAO,MAAM,0BAA0B,eAAe,CAAC;AAEvD,2EAA2E;AAC3E,eAAO,MAAM,gCAAgC,oCAAoE,CAAC;AA4DlH,gDAAgD;AAChD,MAAM,WAAW,0BAA0B;IACzC,uEAAuE;IACvE,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,mEAAmE;IACnE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,6EAA6E;IAC7E,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,SAAS,WAAW,EAAE,EACrC,oBAAoB,EAAE,SAAS,MAAM,EAAE,GACtC,OAAO,CAAC,0BAA0B,CAAC,CAyDrC;AAgGD;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAyCpE;AAiGD;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAa5B"}
@@ -13,6 +13,11 @@
13
13
  * merely contains one's text is a question only a tokenizer can answer, so
14
14
  * the semantic guard is the plugin and the globs are what survives if the
15
15
  * plugin fails to load.
16
+ * - block-host-name-leak → a universal `tool.execute.before` adapter running
17
+ * the canonical Bash wrapper and its two MJS companions. The policy is
18
+ * target-scoped: host trackers retain their own names, while Lisa and
19
+ * unresolved tracker targets retain inspection. Inactive warnings remain
20
+ * visible; the adapter does not reimplement the parser or denylist.
16
21
  * - format-on-edit → OpenCode's BUILT-IN prettier formatter already formats on
17
22
  * edit, so Lisa emits no formatter config (overriding it would be worse than
18
23
  * the default). This is why there is no format plugin below.
@@ -97,6 +102,9 @@ const NO_VERIFY_DENY_PATTERNS = {
97
102
  * in a source checkout and is missing from every installed copy.
98
103
  */
99
104
  const PLUGIN_SUPPORT_FILES = [
105
+ "block-host-name-leak.sh",
106
+ "block-host-name-leak.mjs",
107
+ "host-name-command-context.mjs",
100
108
  "discharge-work-item-gates.sh",
101
109
  "block-managed-file-edits.sh",
102
110
  "block-no-verify.sh",
@@ -1 +1 @@
1
- {"version":3,"file":"hooks-installer.js","sourceRoot":"","sources":["../../src/opencode/hooks-installer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,EACL,UAAU,EACV,MAAM,EACN,KAAK,IAAI,UAAU,GAEpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,cAAc,EAA2B,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,gFAAgF;AAChF,MAAM,CAAC,MAAM,sBAAsB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CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;QACvC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;IACzC,OAAO,OAAO;SACX,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SAC3E,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AACxC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-catalog.d.ts","sourceRoot":"","sources":["../../src/opencode/plugin-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,iDAAiD;AACjD,MAAM,WAAW,kBAAkB;IACjC,sEAAsE;IACtE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,0EAA0E;IAC1E,QAAQ,CAAC,eAAe,EAAE,SAAS,CAAC,WAAW,GAAG,GAAG,CAAC,EAAE,CAAC;CAC1D;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,kBAAkB,EA8DvD,CAAC"}
1
+ {"version":3,"file":"plugin-catalog.d.ts","sourceRoot":"","sources":["../../src/opencode/plugin-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,iDAAiD;AACjD,MAAM,WAAW,kBAAkB;IACjC,sEAAsE;IACtE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,0EAA0E;IAC1E,QAAQ,CAAC,eAAe,EAAE,SAAS,CAAC,WAAW,GAAG,GAAG,CAAC,EAAE,CAAC;CAC1D;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,kBAAkB,EAmEvD,CAAC"}
@@ -19,6 +19,11 @@ export const PLUGIN_CATALOG = [
19
19
  templateFilename: "lisa-block-no-verify.ts",
20
20
  forProjectTypes: ["*"],
21
21
  },
22
+ {
23
+ id: "block-host-name-leak",
24
+ templateFilename: "lisa-block-host-name-leak.ts",
25
+ forProjectTypes: ["*"],
26
+ },
22
27
  {
23
28
  id: "session-bootstrap",
24
29
  templateFilename: "lisa-session-bootstrap.ts",
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-catalog.js","sourceRoot":"","sources":["../../src/opencode/plugin-catalog.ts"],"names":[],"mappings":"AAqBA;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAkC;IAC3D;QACE,EAAE,EAAE,2BAA2B;QAC/B,gBAAgB,EAAE,mCAAmC;QACrD,eAAe,EAAE,CAAC,GAAG,CAAC;KACvB;IACD;QACE,4EAA4E;QAC5E,EAAE,EAAE,mBAAmB;QACvB,gBAAgB,EAAE,2BAA2B;QAC7C,eAAe,EAAE,CAAC,GAAG,CAAC;KACvB;IACD;QACE,EAAE,EAAE,iBAAiB;QACrB,gBAAgB,EAAE,yBAAyB;QAC3C,eAAe,EAAE,CAAC,GAAG,CAAC;KACvB;IACD;QACE,EAAE,EAAE,mBAAmB;QACvB,gBAAgB,EAAE,2BAA2B;QAC7C,eAAe,EAAE,CAAC,GAAG,CAAC;KACvB;IACD;QACE,EAAE,EAAE,8BAA8B;QAClC,gBAAgB,EAAE,sCAAsC;QACxD,eAAe,EAAE,CAAC,GAAG,CAAC;KACvB;IACD;QACE,EAAE,EAAE,0BAA0B;QAC9B,gBAAgB,EAAE,kCAAkC;QACpD,eAAe,EAAE,CAAC,GAAG,CAAC;KACvB;IACD;QACE,EAAE,EAAE,2BAA2B;QAC/B,gBAAgB,EAAE,mCAAmC;QACrD,eAAe,EAAE,CAAC,GAAG,CAAC;KACvB;IACD;QACE,EAAE,EAAE,2BAA2B;QAC/B,gBAAgB,EAAE,mCAAmC;QACrD,eAAe,EAAE,CAAC,YAAY,CAAC;KAChC;IACD;QACE,EAAE,EAAE,cAAc;QAClB,gBAAgB,EAAE,sBAAsB;QACxC,eAAe,EAAE,CAAC,YAAY,CAAC;KAChC;IACD;QACE,EAAE,EAAE,iBAAiB;QACrB,gBAAgB,EAAE,yBAAyB;QAC3C,eAAe,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC;KACzC;IACD;QACE,EAAE,EAAE,uBAAuB;QAC3B,gBAAgB,EAAE,+BAA+B;QACjD,eAAe,EAAE,CAAC,QAAQ,CAAC;KAC5B;IACD;QACE,EAAE,EAAE,iBAAiB;QACrB,gBAAgB,EAAE,yBAAyB;QAC3C,eAAe,EAAE,CAAC,OAAO,CAAC;KAC3B;CACF,CAAC"}
1
+ {"version":3,"file":"plugin-catalog.js","sourceRoot":"","sources":["../../src/opencode/plugin-catalog.ts"],"names":[],"mappings":"AAqBA;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAkC;IAC3D;QACE,EAAE,EAAE,2BAA2B;QAC/B,gBAAgB,EAAE,mCAAmC;QACrD,eAAe,EAAE,CAAC,GAAG,CAAC;KACvB;IACD;QACE,4EAA4E;QAC5E,EAAE,EAAE,mBAAmB;QACvB,gBAAgB,EAAE,2BAA2B;QAC7C,eAAe,EAAE,CAAC,GAAG,CAAC;KACvB;IACD;QACE,EAAE,EAAE,iBAAiB;QACrB,gBAAgB,EAAE,yBAAyB;QAC3C,eAAe,EAAE,CAAC,GAAG,CAAC;KACvB;IACD;QACE,EAAE,EAAE,sBAAsB;QAC1B,gBAAgB,EAAE,8BAA8B;QAChD,eAAe,EAAE,CAAC,GAAG,CAAC;KACvB;IACD;QACE,EAAE,EAAE,mBAAmB;QACvB,gBAAgB,EAAE,2BAA2B;QAC7C,eAAe,EAAE,CAAC,GAAG,CAAC;KACvB;IACD;QACE,EAAE,EAAE,8BAA8B;QAClC,gBAAgB,EAAE,sCAAsC;QACxD,eAAe,EAAE,CAAC,GAAG,CAAC;KACvB;IACD;QACE,EAAE,EAAE,0BAA0B;QAC9B,gBAAgB,EAAE,kCAAkC;QACpD,eAAe,EAAE,CAAC,GAAG,CAAC;KACvB;IACD;QACE,EAAE,EAAE,2BAA2B;QAC/B,gBAAgB,EAAE,mCAAmC;QACrD,eAAe,EAAE,CAAC,GAAG,CAAC;KACvB;IACD;QACE,EAAE,EAAE,2BAA2B;QAC/B,gBAAgB,EAAE,mCAAmC;QACrD,eAAe,EAAE,CAAC,YAAY,CAAC;KAChC;IACD;QACE,EAAE,EAAE,cAAc;QAClB,gBAAgB,EAAE,sBAAsB;QACxC,eAAe,EAAE,CAAC,YAAY,CAAC;KAChC;IACD;QACE,EAAE,EAAE,iBAAiB;QACrB,gBAAgB,EAAE,yBAAyB;QAC3C,eAAe,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC;KACzC;IACD;QACE,EAAE,EAAE,uBAAuB;QAC3B,gBAAgB,EAAE,+BAA+B;QACjD,eAAe,EAAE,CAAC,QAAQ,CAAC;KAC5B;IACD;QACE,EAAE,EAAE,iBAAiB;QACrB,gBAAgB,EAAE,yBAAyB;QAC3C,eAAe,EAAE,CAAC,OAAO,CAAC;KAC3B;CACF,CAAC"}
@@ -0,0 +1,511 @@
1
+ // This file is managed by Lisa and IS replaced on each `lisa` run.
2
+ // Do not edit directly — durable changes belong upstream in Lisa.
3
+
4
+ /**
5
+ * Refuse an outbound tracker write whose title or body names a host project.
6
+ *
7
+ * WHY THIS EXISTS AS A HOOK AND NOT AS MORE PROSE
8
+ *
9
+ * The rule lives in `.claude/rules/PROJECT_RULES.md`, it is repeated in every
10
+ * agent brief, and agents break it anyway. Measured across the full tracker on
11
+ * 2026-09-03 — 193 open issues, 1,461 closed, 1,991 merged pull requests — 513
12
+ * items carried a host identity. The daily rate over the preceding week ran
13
+ * between 1.8% and 28.5% and never reached zero, and the items filed on the day
14
+ * of the count were filed by agents whose briefs carried the rule. Instruction
15
+ * is not reaching the moment of writing, so the check belongs on the write path.
16
+ *
17
+ * This repository is public and `dist/` is in the npm `files` allowlist, so a
18
+ * name written into an issue body is published on github.com AND shipped to
19
+ * every consumer of the package. There is no quiet version of this mistake.
20
+ *
21
+ * WHAT IT IS NOT
22
+ *
23
+ * **This reduces the rate. It does not close the class.** The detector is a
24
+ * curated denylist: a name variant nobody has added — a new spelling, a legal
25
+ * entity, a tracker-site slug, an email domain, an acronym — is invisible to it.
26
+ * One organisation's name in running prose reached three separate issue bodies
27
+ * and was matched by no pattern used during the audit; it is caught today only
28
+ * because a person put that spelling in the list by hand. Read a green result as
29
+ * "none of the known names appeared", never as "this text is clean".
30
+ *
31
+ * WHERE IT LOOKS, AND WHY THAT MATTERS MORE THAN THE MATCHER
32
+ *
33
+ * The convention in this repository is `--body-file <path>`; the text never
34
+ * appears in the command string. A guard that inspects only argv therefore sees
35
+ * nothing and reports clean on every real call — that is #3484's defect, and
36
+ * repeating it here would ship a guard that runs and never bites. So this reads
37
+ * the referenced file, and the title, which is what appears in every listing and
38
+ * notification.
39
+ *
40
+ * WHY THIS IS NOT MATERIALIZED INTO HOST PROJECTS
41
+ *
42
+ * The five sibling PreToolUse guards are copied into host projects through
43
+ * `all/copy-overwrite/scripts/lisa-hooks/`. This one deliberately is not, and
44
+ * the omission is a scope decision rather than an oversight.
45
+ *
46
+ * The denylist holds the names of host projects — the very repositories that
47
+ * install Lisa. Shipped into host project X, this guard would refuse every
48
+ * issue in which X writes its own name, which is normal and correct writing
49
+ * there. The rule it enforces is Lisa's: **this** repository is public and
50
+ * `dist/` ships to npm, so **this** repository may not name its hosts. A host
51
+ * naming itself carries none of that.
52
+ *
53
+ * Claude, Codex, Cursor, Antigravity, Copilot and Devin register the canonical
54
+ * plugin guard. OpenCode installs a native tool.execute.before adapter beside
55
+ * the same wrapper/classifier/helper; its package staging adds only the normal
56
+ * ownership banner. It preserves exit0 warnings and exit2 refusals. All seven
57
+ * surfaces therefore share target-scoped policy, rather than refusing a host
58
+ * project's own name. The generic dispatcher copy-overwrite roster remains
59
+ * separate; this guard is not added to that roster.
60
+ *
61
+ * WHERE IT APPLIES: THE TARGET, NOT THE CHECKOUT (#4462)
62
+ *
63
+ * Not materializing it was not enough. The guard is registered by the PLUGIN,
64
+ * so it runs in every project the plugin is enabled in, and every host has the
65
+ * denylist at `node_modules/@codyswann/lisa/dist/`. Inside a host it refused
66
+ * that host's own tracker writes — including the `Work-Item: <owner>/<repo>#<n>`
67
+ * line the work-item gate REQUIRES in every pull-request body, so the two Lisa
68
+ * guards contradicted each other and every agent-opened host PR failed
69
+ * traceability.
70
+ *
71
+ * So the guard resolves the active gh call's explicit repository or API
72
+ * endpoint, then GH_REPO, the locally selected gh default, or one unambiguous
73
+ * Git remote. Literal cd and environment assignments use the command's actual
74
+ * directory; the project root still locates the detector. Body text is never
75
+ * routing. Unsupported shell syntax, unresolved expansions and ambiguous
76
+ * repositories earn no host exemption. This is bounded command inspection,
77
+ * not shell execution or a claim to close every shell/identity leak class.
78
+ * Literal one-level sh -c and bash -c executable-script operands reuse that
79
+ * inspection with the inherited directory/environment. No other quoted argv
80
+ * is interpreted as code. Dynamic scripts, deeper nesting, other interpreters
81
+ * and other launcher options remain outside this recognition contract.
82
+ *
83
+ * FAILING OPEN, LOUDLY
84
+ *
85
+ * When the denylist cannot be loaded this permits the write and says so on
86
+ * stderr. Failing closed would block every tracker write on a machine without a
87
+ * built `dist/`; failing open silently is worse than either, because a guard
88
+ * that is quietly absent is indistinguishable from a guard that passes. Same
89
+ * reasoning as `block-direct-issue-create.sh`'s interpreter probe.
90
+ * @module hooks/block-host-name-leak
91
+ */
92
+ import { existsSync, readFileSync, realpathSync } from "node:fs";
93
+ import path from "node:path";
94
+ import { fileURLToPath, pathToFileURL } from "node:url";
95
+ import {
96
+ commandRepository,
97
+ ghCommands,
98
+ repositoryFromSpec,
99
+ } from "./host-name-command-context.mjs";
100
+
101
+ export { repositoryFromSpec };
102
+
103
+ /** Claude Code's refusal code. Every other non-zero exit is a hook error. */
104
+ const EXIT_BLOCKED = 2;
105
+ /** Permit the command. */
106
+ const EXIT_ALLOWED = 0;
107
+
108
+ /**
109
+ * Where the compiled detector may live, relative to the governed project.
110
+ *
111
+ * Inside this repository it is the local build; inside a host project it is the
112
+ * installed package. The plugin directory itself is NOT a candidate — it ships
113
+ * `hooks/`, `skills/` and `scripts/` and no `dist/`, so a hook that looked
114
+ * beside itself would find nothing and stand down everywhere.
115
+ */
116
+ const DETECTOR_PATHS = [
117
+ "dist/core/downstream-references.js",
118
+ "node_modules/@codyswann/lisa/dist/core/downstream-references.js",
119
+ ];
120
+
121
+ /** Sub-commands that publish text people read. */
122
+ const WRITE_VERBS = new Set(["create", "comment", "edit"]);
123
+ /** The `gh` nouns whose writes carry prose. */
124
+ const WRITE_NOUNS = new Set(["issue", "pr"]);
125
+ /** HTTP methods that change tracker state. */
126
+ const MUTATING_METHODS = new Set(["POST", "PATCH", "PUT"]);
127
+
128
+ /**
129
+ * Flags whose value is a path to read.
130
+ *
131
+ * `-F` is `--body-file`'s short form on `gh issue`/`gh pr`, and on `gh api` it
132
+ * is `--field`, which may itself carry `@path`. Both are handled — reading a
133
+ * file that turns out to be a literal costs nothing, missing one costs the
134
+ * guard.
135
+ */
136
+ const FILE_FLAGS = new Set(["--body-file", "-F", "--input"]);
137
+ /** Flags whose value is literal text people will read. */
138
+ const TEXT_FLAGS = new Set([
139
+ "--title",
140
+ "-t",
141
+ "--body",
142
+ "-b",
143
+ "--message",
144
+ "-m",
145
+ ]);
146
+ /** `gh api` field flags: `key=value`, or `key=@path` to read a file. */
147
+ const FIELD_FLAGS = new Set(["-f", "-F", "--field", "--raw-field"]);
148
+ /** Field names whose value is published prose rather than metadata. */
149
+ const PROSE_FIELDS = new Set(["body", "title", "text", "message"]);
150
+
151
+ /**
152
+ * The repositories this guard protects, lowercased `owner/repo`.
153
+ *
154
+ * Only this one: it is public and ships `dist/` to npm. A host's own tracker
155
+ * is not on the list, which is the point (#4462).
156
+ */
157
+ const GUARDED_REPOSITORIES = new Set(["codyswanngt/lisa"]);
158
+ /**
159
+ * Vendor endpoints quoted from guard source, which are not host identities.
160
+ *
161
+ * These appear in this repository's own prose when documenting the access
162
+ * layer. Left unguarded they would be a standing false positive, and a guard
163
+ * with false positives is a guard someone turns off.
164
+ */
165
+ const ENDPOINT_ALLOWANCES = [
166
+ "api.linear.app",
167
+ "mcp.linear.app",
168
+ "api.github.com",
169
+ "api.atlassian.com",
170
+ ];
171
+
172
+ /**
173
+ * Split a command line into argv, honouring single and double quotes.
174
+ *
175
+ * Deliberately not a shell: it does not expand variables, globs or command
176
+ * substitution. Those would let the guard's own reading diverge from what the
177
+ * shell will actually run, and a guard that models the shell imperfectly is
178
+ * worse than one that reads tokens plainly.
179
+ * @param command - The raw command string.
180
+ * @returns The tokens, quotes stripped.
181
+ */
182
+ export function tokenize(command) {
183
+ const tokens = [];
184
+ let current = "";
185
+ let quote = "";
186
+ let started = false;
187
+ for (const char of command) {
188
+ if (quote !== "") {
189
+ if (char === quote) quote = "";
190
+ else current += char;
191
+ started = true;
192
+ } else if (char === '"' || char === "'") {
193
+ quote = char;
194
+ started = true;
195
+ } else if (/\s/u.test(char)) {
196
+ if (started) tokens.push(current);
197
+ current = "";
198
+ started = false;
199
+ } else {
200
+ current += char;
201
+ started = true;
202
+ }
203
+ }
204
+ if (started) tokens.push(current);
205
+ return tokens;
206
+ }
207
+
208
+ /**
209
+ * Whether these tokens are a `gh` call that publishes tracker text.
210
+ *
211
+ * Reads (`view`, `list`, `status`) and non-tracker writes (`gh label create`)
212
+ * are not writes of prose and do not fire.
213
+ * @param tokens - Command tokens.
214
+ * @returns True when the command publishes text.
215
+ */
216
+ export function isOutboundTrackerWrite(tokens) {
217
+ return ghCommands(
218
+ tokens.map(token => JSON.stringify(token)).join(" "),
219
+ process.cwd()
220
+ ).some(context => context.writes);
221
+ }
222
+
223
+ /**
224
+ * The value a flag carries, in either `--flag value` or `--flag=value` form.
225
+ * @param tokens - Command tokens.
226
+ * @param index - Index of the flag token.
227
+ * @returns The value, or an empty string.
228
+ */
229
+ function valueAt(tokens, index) {
230
+ const token = tokens[index] ?? "";
231
+ const equals = token.indexOf("=");
232
+ if (equals !== -1 && token.startsWith("-")) return token.slice(equals + 1);
233
+ return tokens[index + 1] ?? "";
234
+ }
235
+
236
+ /**
237
+ * Resolve the target of one tokenized command without treating prose as routing.
238
+ * @param tokens Command tokens.
239
+ * @param cwd Actual command working directory.
240
+ * @returns Verified owner/repository, or unknown.
241
+ */
242
+ export function targetRepository(tokens, cwd) {
243
+ const context = ghCommands(
244
+ tokens.map(token => JSON.stringify(token)).join(" "),
245
+ cwd
246
+ )[0];
247
+ return context === undefined ? undefined : commandRepository(context);
248
+ }
249
+
250
+ /**
251
+ * Whether the guard applies to a write landing in this repository.
252
+ *
253
+ * An undetermined target is guarded: not knowing where text is going is no
254
+ * reason to stop protecting the one place it must not go.
255
+ * @param target - `owner/repo`, or undefined.
256
+ * @returns True when the write must be checked.
257
+ */
258
+ export function isGuardedTarget(target) {
259
+ return target === undefined || GUARDED_REPOSITORIES.has(target);
260
+ }
261
+
262
+ /**
263
+ * Read a file the command names, if it is readable.
264
+ * @param candidate - Path as written on the command line.
265
+ * @param cwd - Directory the command runs in.
266
+ * @returns The contents, or an empty string.
267
+ */
268
+ function readIfPresent(candidate, cwd) {
269
+ if (candidate === "" || candidate === "-") return "";
270
+ const resolved = path.isAbsolute(candidate)
271
+ ? candidate
272
+ : path.join(cwd, candidate);
273
+ if (!existsSync(resolved)) return "";
274
+ try {
275
+ return readFileSync(resolved, "utf-8");
276
+ } catch {
277
+ return "";
278
+ }
279
+ }
280
+
281
+ /**
282
+ * Every piece of text this command would publish, labelled by where it came
283
+ * from so the refusal can point at the thing to edit.
284
+ * @param tokens - Command tokens.
285
+ * @param cwd - Directory the command runs in.
286
+ * @param noun - The active gh noun, so api fields retain their own meaning.
287
+ * @returns Sources of publishable text.
288
+ */
289
+ export function publishableText(tokens, cwd, noun) {
290
+ return tokens.flatMap((token, index) => {
291
+ const bare = token.startsWith("-") ? token.split("=")[0] : token;
292
+ if (noun !== "api" && TEXT_FLAGS.has(bare)) {
293
+ return [{ origin: bare, text: valueAt(tokens, index) }];
294
+ }
295
+ if (FILE_FLAGS.has(bare)) {
296
+ const value = valueAt(tokens, index);
297
+ // On `gh api`, `-F` is `--field`: `key=@path` or `key=value`. Read as a
298
+ // bare path, `body=@file` named no file and published unchecked (#4462).
299
+ if (
300
+ (noun === "api" || (noun === undefined && bare === "-F")) &&
301
+ /^[\w.[\]-]+=/u.test(value)
302
+ ) {
303
+ const field = fieldSource(value, cwd);
304
+ if (noun === "api") return [field];
305
+ // An unresolved noun may become api or issue/pr. Inspect both possible
306
+ // meanings of -F without evaluating the expansion or certifying routing.
307
+ return [field, { origin: value, text: readIfPresent(value, cwd) }];
308
+ }
309
+ const file = value.replace(/^@/u, "");
310
+ return [{ origin: file, text: readIfPresent(file, cwd) }];
311
+ }
312
+ if (FIELD_FLAGS.has(bare))
313
+ return [fieldSource(valueAt(tokens, index), cwd)];
314
+ return [];
315
+ });
316
+ }
317
+
318
+ /**
319
+ * One `gh api` field, which may be literal or a file reference.
320
+ * @param assignment - The raw `key=value` token.
321
+ * @param cwd - Directory the command runs in.
322
+ * @returns A text source; empty when the field is not prose.
323
+ */
324
+ function fieldSource(assignment, cwd) {
325
+ const split = assignment.indexOf("=");
326
+ if (split === -1) return { origin: "", text: "" };
327
+ const key = assignment.slice(0, split);
328
+ const value = assignment.slice(split + 1);
329
+ if (!PROSE_FIELDS.has(key)) return { origin: "", text: "" };
330
+ if (value.startsWith("@")) {
331
+ const file = value.slice(1);
332
+ return { origin: file, text: readIfPresent(file, cwd) };
333
+ }
334
+ return { origin: key, text: value };
335
+ }
336
+
337
+ /**
338
+ * Whether a matched span sits inside a vendor endpoint rather than a name.
339
+ * @param line - The line the match came from.
340
+ * @param match - The matched span.
341
+ * @returns True when the match is an allowed endpoint.
342
+ */
343
+ function isEndpoint(line, match) {
344
+ return ENDPOINT_ALLOWANCES.some(
345
+ endpoint =>
346
+ endpoint.includes(match.toLowerCase()) && line.includes(endpoint)
347
+ );
348
+ }
349
+
350
+ /**
351
+ * Load the compiled detector from the governed project.
352
+ * @param projectDir - The project the command runs in.
353
+ * @returns The detector module, or undefined when it cannot be found.
354
+ */
355
+ async function loadDetector(projectDir) {
356
+ for (const candidate of DETECTOR_PATHS) {
357
+ const resolved = path.join(projectDir, candidate);
358
+ if (!existsSync(resolved)) continue;
359
+ try {
360
+ return await import(pathToFileURL(resolved).href);
361
+ } catch {
362
+ return undefined;
363
+ }
364
+ }
365
+ return undefined;
366
+ }
367
+
368
+ /**
369
+ * Every host-name violation in one text source.
370
+ * @param source - The labelled text.
371
+ * @param detector - The loaded detector module.
372
+ * @returns Findings, each naming its origin and line.
373
+ */
374
+ function findingsIn(source, detector) {
375
+ if (source.text === "") return [];
376
+ const lines = source.text.split("\n");
377
+ return detector
378
+ .findDownstreamReferences(source.text)
379
+ .filter(hit => !isEndpoint(lines[hit.line - 1] ?? "", hit.match))
380
+ .map(hit => ({ ...hit, origin: source.origin }));
381
+ }
382
+
383
+ /**
384
+ * Render the refusal an agent will act on.
385
+ * @param findings - Every violation found.
386
+ * @returns The message body.
387
+ */
388
+ export function formatRefusal(findings) {
389
+ const located = findings
390
+ .map(hit => ` ${hit.origin}:${hit.line} — "${hit.match}" (${hit.reason})`)
391
+ .join("\n");
392
+ return `BLOCKED: this tracker write names a host project.
393
+
394
+ ${located}
395
+
396
+ WHY: this repository is public and \`dist/\` ships to npm, so a host identity in
397
+ an issue body is published twice — on github.com and to every consumer of the
398
+ package. See the "Never name a downstream project" rule.
399
+
400
+ FIX: write the evidence, not the identity. "a caller repo in the portfolio",
401
+ "repo A" / "repo B" where two are contrasted, \`<ticket>\` for a real ticket id.
402
+ The argument never depends on which named client proved it — if it seems to,
403
+ the argument is the thing to fix.
404
+
405
+ SCOPE: this checks a curated list of known names. It is a rate reduction, not a
406
+ closed class — a spelling nobody has added is invisible to it, so a clean result
407
+ means "no known name appeared", not "this text is safe".`;
408
+ }
409
+
410
+ /**
411
+ * Evaluate one command.
412
+ * @param command - The command string.
413
+ * @param projectDir - The project the command runs in.
414
+ * @returns The exit code and any message.
415
+ */
416
+ export async function evaluate(command, projectDir) {
417
+ let detector;
418
+ const findings = [];
419
+ for (const context of ghCommands(command, process.cwd())) {
420
+ if (!context.writes || !isGuardedTarget(commandRepository(context)))
421
+ continue;
422
+ detector ??= await loadDetector(projectDir);
423
+ if (detector === undefined) {
424
+ return {
425
+ code: EXIT_ALLOWED,
426
+ warning:
427
+ "block-host-name-leak: host-name denylist not found (no built dist/ or installed package); host-identity enforcement is NOT active",
428
+ };
429
+ }
430
+ // Without a known cwd a relative file cannot be inspected honestly. Keep
431
+ // protection, and name the unread input instead of claiming the text clean.
432
+ if (
433
+ context.cwd === undefined &&
434
+ [
435
+ ...context.flags,
436
+ ...(context.noun === "api" || context.noun === undefined
437
+ ? context.fieldOccurrences
438
+ : []),
439
+ ].some(([flag, item]) => {
440
+ const field =
441
+ (context.noun === "api" || context.noun === undefined) &&
442
+ FIELD_FLAGS.has(flag)
443
+ ? /^([^=]+)=@(.+)$/u.exec(item.value)
444
+ : null;
445
+ const files = [
446
+ field !== null && PROSE_FIELDS.has(field[1]) ? field[2] : undefined,
447
+ FILE_FLAGS.has(flag) && (context.noun !== "api" || field === null)
448
+ ? item.value.replace(/^@/, "")
449
+ : undefined,
450
+ ];
451
+ return files.some(file => file !== undefined && !path.isAbsolute(file));
452
+ })
453
+ ) {
454
+ return {
455
+ code: EXIT_BLOCKED,
456
+ message:
457
+ "BLOCKED: the working directory for this tracker write's body file could not be resolved. Use a literal directory and readable body file so the host-name guard can inspect it.",
458
+ };
459
+ }
460
+ findings.push(
461
+ ...publishableText(
462
+ context.tokens,
463
+ context.cwd ?? projectDir,
464
+ context.noun
465
+ ).flatMap(source => findingsIn(source, detector))
466
+ );
467
+ }
468
+ if (findings.length === 0) return { code: EXIT_ALLOWED };
469
+ return { code: EXIT_BLOCKED, message: formatRefusal(findings) };
470
+ }
471
+
472
+ /** Entry point: `node block-host-name-leak.mjs <command> [projectDir]`. */
473
+ async function main() {
474
+ const [, , command = "", projectDir = process.cwd()] = process.argv;
475
+ if (command === "") process.exit(EXIT_ALLOWED);
476
+ const result = await evaluate(command, projectDir);
477
+ if (result.warning !== undefined) process.stderr.write(`${result.warning}\n`);
478
+ if (result.message !== undefined) process.stderr.write(`${result.message}\n`);
479
+ process.exit(result.code);
480
+ }
481
+
482
+ /**
483
+ * Whether this module is the process entry point.
484
+ *
485
+ * Both sides are realpath'd: comparing `fileURLToPath(import.meta.url)` against
486
+ * `process.argv[1]` disagrees whenever the checkout is reached through a
487
+ * symlink — a git worktree, or any `/tmp` path on macOS, `/tmp` being a symlink
488
+ * to `/private/tmp` — because `import.meta.url` is the REAL path while
489
+ * `argv[1]` is whatever the caller typed. Comparing basenames, which an earlier
490
+ * draft of this file did, matches any file that happens to share a name.
491
+ *
492
+ * The one implementation lives at `scripts/lib/invoked-as-script.mjs`. This
493
+ * file cannot import it: it is materialized into every plugin payload, where
494
+ * there is no `./lib/` to import from — the same accommodation
495
+ * `inject-resolved-config.mjs` and `threshold-ratchet.mjs` make.
496
+ * @param {string} moduleUrl The caller's own `import.meta.url`.
497
+ * @param {string | undefined} [argv1] Entry path; defaults to `process.argv[1]`.
498
+ * @returns {boolean} Whether the caller should run its CLI body.
499
+ */
500
+ export function invokedAsScript(moduleUrl, argv1 = process.argv[1]) {
501
+ if (!argv1) return false;
502
+ try {
503
+ return realpathSync(argv1) === realpathSync(fileURLToPath(moduleUrl));
504
+ } catch {
505
+ return false;
506
+ }
507
+ }
508
+
509
+ if (invokedAsScript(import.meta.url)) {
510
+ await main();
511
+ }