@codyswann/lisa 8.9.0 → 8.10.1

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 (266) hide show
  1. package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +1 -1
  2. package/dist/core/lisa-owned-hash-ledger.json +6 -0
  3. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  4. package/dist/core/nightly-e2e-guard-behavior-certificate.js.map +1 -1
  5. package/dist/core/upstream-evidence-manifest.json +57 -29
  6. package/package.json +4 -4
  7. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  8. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  9. package/plugins/lisa/.codex-plugin/scripts/intake-blocker-reprobe.mjs +195 -23
  10. package/plugins/lisa/.codex-plugin/scripts/operator-id-kinds.mjs +41 -2
  11. package/plugins/lisa/.codex-plugin/scripts/ready-queue-order.mjs +69 -0
  12. package/plugins/lisa/.codex-plugin/skills/lisa-github-build-intake/SKILL.md +10 -0
  13. package/plugins/lisa/.codex-plugin/skills/lisa-github-write-issue/SKILL.md +11 -1
  14. package/plugins/lisa/.codex-plugin/skills/lisa-jira-build-intake/SKILL.md +10 -0
  15. package/plugins/lisa/.codex-plugin/skills/lisa-jira-read-ticket/SKILL.md +2 -0
  16. package/plugins/lisa/.codex-plugin/skills/lisa-jira-write-ticket/SKILL.md +11 -1
  17. package/plugins/lisa/.codex-plugin/skills/lisa-linear-build-intake/SKILL.md +10 -0
  18. package/plugins/lisa/.codex-plugin/skills/lisa-linear-read-issue/SKILL.md +2 -0
  19. package/plugins/lisa/.codex-plugin/skills/lisa-linear-write-issue/SKILL.md +11 -1
  20. package/plugins/lisa/.codex-plugin/skills/lisa-repair-intake/SKILL.md +10 -0
  21. package/plugins/lisa/.codex-plugin/skills/lisa-secrets-access/scripts/task-action.mjs +3 -1
  22. package/plugins/lisa/.codex-plugin/skills/lisa-secrets-access/scripts/task-context-write.mjs +40 -9
  23. package/plugins/lisa/.codex-plugin/skills/lisa-secrets-access/scripts/task-unbound.mjs +169 -0
  24. package/plugins/lisa/.codex-plugin/skills/lisa-secrets-access/scripts/validate-config.mjs +94 -4
  25. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/SKILL.md +11 -0
  26. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-cycle.mjs +3 -3
  27. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-human.mjs +3 -1
  28. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-orphans.mjs +4 -1
  29. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-queue.mjs +8 -5
  30. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/config.mjs +28 -4
  31. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/orphan-sweep.mjs +2 -1
  32. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/queue-github.mjs +4 -1
  33. package/plugins/lisa/.codex-plugin/skills/lisa-track/SKILL.md +11 -1
  34. package/plugins/lisa/.codex-plugin/skills/lisa-tracker-build-intake/SKILL.md +11 -1
  35. package/plugins/lisa/rules/reference/config-resolution.md +1 -1
  36. package/plugins/lisa/rules/reference/ready-role-filing.md +55 -5
  37. package/plugins/lisa/rules/reference/tracked-work.md +8 -0
  38. package/plugins/lisa/scripts/intake-blocker-reprobe.mjs +195 -23
  39. package/plugins/lisa/scripts/operator-id-kinds.mjs +41 -2
  40. package/plugins/lisa/scripts/ready-queue-order.mjs +69 -0
  41. package/plugins/lisa/skills/lisa-github-build-intake/SKILL.md +10 -0
  42. package/plugins/lisa/skills/lisa-github-write-issue/SKILL.md +11 -1
  43. package/plugins/lisa/skills/lisa-jira-build-intake/SKILL.md +10 -0
  44. package/plugins/lisa/skills/lisa-jira-read-ticket/SKILL.md +2 -0
  45. package/plugins/lisa/skills/lisa-jira-write-ticket/SKILL.md +11 -1
  46. package/plugins/lisa/skills/lisa-linear-build-intake/SKILL.md +10 -0
  47. package/plugins/lisa/skills/lisa-linear-read-issue/SKILL.md +2 -0
  48. package/plugins/lisa/skills/lisa-linear-write-issue/SKILL.md +11 -1
  49. package/plugins/lisa/skills/lisa-repair-intake/SKILL.md +10 -0
  50. package/plugins/lisa/skills/lisa-secrets-access/scripts/task-action.mjs +3 -1
  51. package/plugins/lisa/skills/lisa-secrets-access/scripts/task-context-write.mjs +40 -9
  52. package/plugins/lisa/skills/lisa-secrets-access/scripts/task-unbound.mjs +169 -0
  53. package/plugins/lisa/skills/lisa-secrets-access/scripts/validate-config.mjs +94 -4
  54. package/plugins/lisa/skills/lisa-session-manager/SKILL.md +11 -0
  55. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-cycle.mjs +3 -3
  56. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-human.mjs +3 -1
  57. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-orphans.mjs +4 -1
  58. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-queue.mjs +8 -5
  59. package/plugins/lisa/skills/lisa-session-manager/scripts/config.mjs +28 -4
  60. package/plugins/lisa/skills/lisa-session-manager/scripts/orphan-sweep.mjs +2 -1
  61. package/plugins/lisa/skills/lisa-session-manager/scripts/queue-github.mjs +4 -1
  62. package/plugins/lisa/skills/lisa-track/SKILL.md +11 -1
  63. package/plugins/lisa/skills/lisa-tracker-build-intake/SKILL.md +11 -1
  64. package/plugins/lisa-agy/plugin.json +1 -1
  65. package/plugins/lisa-agy/scripts/intake-blocker-reprobe.mjs +195 -23
  66. package/plugins/lisa-agy/scripts/operator-id-kinds.mjs +41 -2
  67. package/plugins/lisa-agy/scripts/ready-queue-order.mjs +69 -0
  68. package/plugins/lisa-agy/skills/lisa-github-build-intake/SKILL.md +10 -0
  69. package/plugins/lisa-agy/skills/lisa-github-write-issue/SKILL.md +11 -1
  70. package/plugins/lisa-agy/skills/lisa-jira-build-intake/SKILL.md +10 -0
  71. package/plugins/lisa-agy/skills/lisa-jira-read-ticket/SKILL.md +2 -0
  72. package/plugins/lisa-agy/skills/lisa-jira-write-ticket/SKILL.md +11 -1
  73. package/plugins/lisa-agy/skills/lisa-linear-build-intake/SKILL.md +10 -0
  74. package/plugins/lisa-agy/skills/lisa-linear-read-issue/SKILL.md +2 -0
  75. package/plugins/lisa-agy/skills/lisa-linear-write-issue/SKILL.md +11 -1
  76. package/plugins/lisa-agy/skills/lisa-repair-intake/SKILL.md +10 -0
  77. package/plugins/lisa-agy/skills/lisa-secrets-access/scripts/task-action.mjs +3 -1
  78. package/plugins/lisa-agy/skills/lisa-secrets-access/scripts/task-context-write.mjs +40 -9
  79. package/plugins/lisa-agy/skills/lisa-secrets-access/scripts/task-unbound.mjs +169 -0
  80. package/plugins/lisa-agy/skills/lisa-secrets-access/scripts/validate-config.mjs +94 -4
  81. package/plugins/lisa-agy/skills/lisa-session-manager/SKILL.md +11 -0
  82. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-cycle.mjs +3 -3
  83. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-human.mjs +3 -1
  84. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-orphans.mjs +4 -1
  85. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-queue.mjs +8 -5
  86. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/config.mjs +28 -4
  87. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/orphan-sweep.mjs +2 -1
  88. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/queue-github.mjs +4 -1
  89. package/plugins/lisa-agy/skills/lisa-track/SKILL.md +11 -1
  90. package/plugins/lisa-agy/skills/lisa-tracker-build-intake/SKILL.md +11 -1
  91. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  92. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  93. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  94. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  95. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  96. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  97. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  98. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  99. package/plugins/lisa-copilot/rules/reference/config-resolution.md +1 -1
  100. package/plugins/lisa-copilot/rules/reference/ready-role-filing.md +55 -5
  101. package/plugins/lisa-copilot/rules/reference/tracked-work.md +8 -0
  102. package/plugins/lisa-copilot/scripts/intake-blocker-reprobe.mjs +195 -23
  103. package/plugins/lisa-copilot/scripts/operator-id-kinds.mjs +41 -2
  104. package/plugins/lisa-copilot/scripts/ready-queue-order.mjs +69 -0
  105. package/plugins/lisa-copilot/skills/lisa-github-build-intake/SKILL.md +10 -0
  106. package/plugins/lisa-copilot/skills/lisa-github-write-issue/SKILL.md +11 -1
  107. package/plugins/lisa-copilot/skills/lisa-jira-build-intake/SKILL.md +10 -0
  108. package/plugins/lisa-copilot/skills/lisa-jira-read-ticket/SKILL.md +2 -0
  109. package/plugins/lisa-copilot/skills/lisa-jira-write-ticket/SKILL.md +11 -1
  110. package/plugins/lisa-copilot/skills/lisa-linear-build-intake/SKILL.md +10 -0
  111. package/plugins/lisa-copilot/skills/lisa-linear-read-issue/SKILL.md +2 -0
  112. package/plugins/lisa-copilot/skills/lisa-linear-write-issue/SKILL.md +11 -1
  113. package/plugins/lisa-copilot/skills/lisa-repair-intake/SKILL.md +10 -0
  114. package/plugins/lisa-copilot/skills/lisa-secrets-access/scripts/task-action.mjs +3 -1
  115. package/plugins/lisa-copilot/skills/lisa-secrets-access/scripts/task-context-write.mjs +40 -9
  116. package/plugins/lisa-copilot/skills/lisa-secrets-access/scripts/task-unbound.mjs +169 -0
  117. package/plugins/lisa-copilot/skills/lisa-secrets-access/scripts/validate-config.mjs +94 -4
  118. package/plugins/lisa-copilot/skills/lisa-session-manager/SKILL.md +11 -0
  119. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-cycle.mjs +3 -3
  120. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-human.mjs +3 -1
  121. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-orphans.mjs +4 -1
  122. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-queue.mjs +8 -5
  123. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/config.mjs +28 -4
  124. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/orphan-sweep.mjs +2 -1
  125. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/queue-github.mjs +4 -1
  126. package/plugins/lisa-copilot/skills/lisa-track/SKILL.md +11 -1
  127. package/plugins/lisa-copilot/skills/lisa-tracker-build-intake/SKILL.md +11 -1
  128. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  129. package/plugins/lisa-cursor/rules/config-resolution-reference.mdc +1 -1
  130. package/plugins/lisa-cursor/rules/ready-role-filing-reference.mdc +55 -5
  131. package/plugins/lisa-cursor/rules/tracked-work-reference.mdc +8 -0
  132. package/plugins/lisa-cursor/scripts/intake-blocker-reprobe.mjs +195 -23
  133. package/plugins/lisa-cursor/scripts/operator-id-kinds.mjs +41 -2
  134. package/plugins/lisa-cursor/scripts/ready-queue-order.mjs +69 -0
  135. package/plugins/lisa-cursor/skills/lisa-github-build-intake/SKILL.md +10 -0
  136. package/plugins/lisa-cursor/skills/lisa-github-write-issue/SKILL.md +11 -1
  137. package/plugins/lisa-cursor/skills/lisa-jira-build-intake/SKILL.md +10 -0
  138. package/plugins/lisa-cursor/skills/lisa-jira-read-ticket/SKILL.md +2 -0
  139. package/plugins/lisa-cursor/skills/lisa-jira-write-ticket/SKILL.md +11 -1
  140. package/plugins/lisa-cursor/skills/lisa-linear-build-intake/SKILL.md +10 -0
  141. package/plugins/lisa-cursor/skills/lisa-linear-read-issue/SKILL.md +2 -0
  142. package/plugins/lisa-cursor/skills/lisa-linear-write-issue/SKILL.md +11 -1
  143. package/plugins/lisa-cursor/skills/lisa-repair-intake/SKILL.md +10 -0
  144. package/plugins/lisa-cursor/skills/lisa-secrets-access/scripts/task-action.mjs +3 -1
  145. package/plugins/lisa-cursor/skills/lisa-secrets-access/scripts/task-context-write.mjs +40 -9
  146. package/plugins/lisa-cursor/skills/lisa-secrets-access/scripts/task-unbound.mjs +169 -0
  147. package/plugins/lisa-cursor/skills/lisa-secrets-access/scripts/validate-config.mjs +94 -4
  148. package/plugins/lisa-cursor/skills/lisa-session-manager/SKILL.md +11 -0
  149. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-cycle.mjs +3 -3
  150. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-human.mjs +3 -1
  151. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-orphans.mjs +4 -1
  152. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-queue.mjs +8 -5
  153. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/config.mjs +28 -4
  154. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/orphan-sweep.mjs +2 -1
  155. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/queue-github.mjs +4 -1
  156. package/plugins/lisa-cursor/skills/lisa-track/SKILL.md +11 -1
  157. package/plugins/lisa-cursor/skills/lisa-tracker-build-intake/SKILL.md +11 -1
  158. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  159. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  160. package/plugins/lisa-devin/rules/reference/config-resolution.md +1 -1
  161. package/plugins/lisa-devin/rules/reference/ready-role-filing.md +55 -5
  162. package/plugins/lisa-devin/rules/reference/tracked-work.md +8 -0
  163. package/plugins/lisa-devin/scripts/intake-blocker-reprobe.mjs +195 -23
  164. package/plugins/lisa-devin/scripts/operator-id-kinds.mjs +41 -2
  165. package/plugins/lisa-devin/scripts/ready-queue-order.mjs +69 -0
  166. package/plugins/lisa-devin/skills/lisa-github-build-intake/SKILL.md +10 -0
  167. package/plugins/lisa-devin/skills/lisa-github-write-issue/SKILL.md +11 -1
  168. package/plugins/lisa-devin/skills/lisa-jira-build-intake/SKILL.md +10 -0
  169. package/plugins/lisa-devin/skills/lisa-jira-read-ticket/SKILL.md +2 -0
  170. package/plugins/lisa-devin/skills/lisa-jira-write-ticket/SKILL.md +11 -1
  171. package/plugins/lisa-devin/skills/lisa-linear-build-intake/SKILL.md +10 -0
  172. package/plugins/lisa-devin/skills/lisa-linear-read-issue/SKILL.md +2 -0
  173. package/plugins/lisa-devin/skills/lisa-linear-write-issue/SKILL.md +11 -1
  174. package/plugins/lisa-devin/skills/lisa-repair-intake/SKILL.md +10 -0
  175. package/plugins/lisa-devin/skills/lisa-secrets-access/scripts/task-action.mjs +3 -1
  176. package/plugins/lisa-devin/skills/lisa-secrets-access/scripts/task-context-write.mjs +40 -9
  177. package/plugins/lisa-devin/skills/lisa-secrets-access/scripts/task-unbound.mjs +169 -0
  178. package/plugins/lisa-devin/skills/lisa-secrets-access/scripts/validate-config.mjs +94 -4
  179. package/plugins/lisa-devin/skills/lisa-session-manager/SKILL.md +11 -0
  180. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-cycle.mjs +3 -3
  181. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-human.mjs +3 -1
  182. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-orphans.mjs +4 -1
  183. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-queue.mjs +8 -5
  184. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/config.mjs +28 -4
  185. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/orphan-sweep.mjs +2 -1
  186. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/queue-github.mjs +4 -1
  187. package/plugins/lisa-devin/skills/lisa-track/SKILL.md +11 -1
  188. package/plugins/lisa-devin/skills/lisa-tracker-build-intake/SKILL.md +11 -1
  189. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  190. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  191. package/plugins/lisa-expo-agy/plugin.json +1 -1
  192. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  193. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  194. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  195. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  196. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  197. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  198. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  199. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  200. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  201. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  202. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  203. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  204. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  205. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  206. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  207. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  208. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  209. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  210. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  211. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  212. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  213. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  214. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  215. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  216. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  217. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  218. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  219. package/plugins/lisa-rails-agy/plugin.json +1 -1
  220. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  221. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  222. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  223. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  224. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  225. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  226. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  227. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  228. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  229. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  230. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  231. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  232. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  233. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  234. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  235. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  236. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  237. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  238. package/plugins/src/base/rules/reference/config-resolution.md +1 -1
  239. package/plugins/src/base/rules/reference/ready-role-filing.md +55 -5
  240. package/plugins/src/base/rules/reference/tracked-work.md +8 -0
  241. package/plugins/src/base/scripts/intake-blocker-reprobe.mjs +195 -23
  242. package/plugins/src/base/scripts/operator-id-kinds.mjs +41 -2
  243. package/plugins/src/base/scripts/ready-queue-order.mjs +69 -0
  244. package/plugins/src/base/skills/lisa-github-build-intake/SKILL.md +10 -0
  245. package/plugins/src/base/skills/lisa-github-write-issue/SKILL.md +11 -1
  246. package/plugins/src/base/skills/lisa-jira-build-intake/SKILL.md +10 -0
  247. package/plugins/src/base/skills/lisa-jira-read-ticket/SKILL.md +2 -0
  248. package/plugins/src/base/skills/lisa-jira-write-ticket/SKILL.md +11 -1
  249. package/plugins/src/base/skills/lisa-linear-build-intake/SKILL.md +10 -0
  250. package/plugins/src/base/skills/lisa-linear-read-issue/SKILL.md +2 -0
  251. package/plugins/src/base/skills/lisa-linear-write-issue/SKILL.md +11 -1
  252. package/plugins/src/base/skills/lisa-repair-intake/SKILL.md +10 -0
  253. package/plugins/src/base/skills/lisa-secrets-access/scripts/task-action.mjs +3 -1
  254. package/plugins/src/base/skills/lisa-secrets-access/scripts/task-context-write.mjs +40 -9
  255. package/plugins/src/base/skills/lisa-secrets-access/scripts/task-unbound.mjs +169 -0
  256. package/plugins/src/base/skills/lisa-secrets-access/scripts/validate-config.mjs +94 -4
  257. package/plugins/src/base/skills/lisa-session-manager/SKILL.md +11 -0
  258. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-cycle.mjs +3 -3
  259. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-human.mjs +3 -1
  260. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-orphans.mjs +4 -1
  261. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-queue.mjs +8 -5
  262. package/plugins/src/base/skills/lisa-session-manager/scripts/config.mjs +28 -4
  263. package/plugins/src/base/skills/lisa-session-manager/scripts/orphan-sweep.mjs +2 -1
  264. package/plugins/src/base/skills/lisa-session-manager/scripts/queue-github.mjs +4 -1
  265. package/plugins/src/base/skills/lisa-track/SKILL.md +11 -1
  266. package/plugins/src/base/skills/lisa-tracker-build-intake/SKILL.md +11 -1
@@ -27,6 +27,13 @@
27
27
  * person, so it cannot answer a question or release a human hold: those
28
28
  * readers drop it (`idComparableValues`, the answer matcher), and the
29
29
  * validator refuses it in `operatorIds` and `trustedReleaseIds`.
30
+ * - `relay:<account id>` names an automation account that may RELAY a trusted
31
+ * person's hold release (CodySwannGT/lisa#5190), and is meaningful only in
32
+ * `trustedReleaseIds`. It is not a person. It matches nobody in any
33
+ * people-matching reader (there is no `relay` field to match), so it can
34
+ * never be an operator, author dispatched work, or answer a question. Only
35
+ * the hold-release check reads it, through {@link releaseComparableValues},
36
+ * and there it counts only for a release line that names a trusted person.
30
37
  * - A plain entry (no prefix) keeps exactly the meaning each reader gave it
31
38
  * before kind-keyed entries existed. Changing that is a later, breaking
32
39
  * change.
@@ -49,7 +56,12 @@
49
56
  */
50
57
 
51
58
  /** The kinds a prefixed entry may name. */
52
- export const ID_ENTRY_KINDS = Object.freeze(["login", "id", "integration"]);
59
+ export const ID_ENTRY_KINDS = Object.freeze([
60
+ "login",
61
+ "id",
62
+ "integration",
63
+ "relay",
64
+ ]);
53
65
 
54
66
  /** A letters-only prefix at the start of an entry. */
55
67
  const PREFIX = /^([A-Za-z]+):/;
@@ -61,7 +73,7 @@ const PREFIX = /^([A-Za-z]+):/;
61
73
  const PLAIN_ID_STARTS = new Set(["qm"]);
62
74
 
63
75
  /**
64
- * @typedef {{ kind: "login" | "id" | "integration" | "plain", value: string }
76
+ * @typedef {{ kind: "login" | "id" | "integration" | "relay" | "plain", value: string }
65
77
  * | { kind: "invalid", problem: "unknown-prefix" | "empty-value", prefix: string }} IdEntry
66
78
  */
67
79
 
@@ -131,3 +143,30 @@ export function idComparableValues(entries) {
131
143
  .filter(entry => entry.kind === "plain" || entry.kind === "id")
132
144
  .map(entry => entry.value);
133
145
  }
146
+
147
+ /**
148
+ * What the hold-release check compares: the people an id-only comparator may
149
+ * hold ({@link idComparableValues}), then each relay account written back as
150
+ * `relay:<id>`. The release check in `intake-blocker-reprobe.mjs` reads a
151
+ * `relay:` entry as an account that may post a release for one of the people
152
+ * in the same list, and never as a person. Only release readers call this:
153
+ * passing its output to a reader that matches people would be harmless (no
154
+ * account id starts with `relay:`), and passing {@link idComparableValues} to
155
+ * a release reader silently drops every configured relay.
156
+ * @param {unknown} entries - The configured release list
157
+ * @returns {string[]} Person ids, then `relay:<id>` entries
158
+ */
159
+ export function releaseComparableValues(entries) {
160
+ return [
161
+ // The release check reads any value that starts `relay:` as a relay. Only
162
+ // an entry WRITTEN as `relay:<id>` may be one, so a person value that
163
+ // would read that way (`id:relay:9`, or ` relay:9` with a space in front)
164
+ // is dropped: it names nobody, and validation refuses it.
165
+ ...idComparableValues(entries).filter(
166
+ value => !value.trim().toLowerCase().startsWith("relay:")
167
+ ),
168
+ ...parseIdEntries(entries)
169
+ .filter(entry => entry.kind === "relay")
170
+ .map(entry => `relay:${entry.value}`),
171
+ ];
172
+ }
@@ -176,6 +176,75 @@ export function adfText(node) {
176
176
  return children.map(adfText).join(joiner);
177
177
  }
178
178
 
179
+ /** Jira text marks that make a line something other than a statement. */
180
+ const NOT_STATED_MARKS = new Set(["code", "strike"]);
181
+
182
+ /**
183
+ * Whether any text under a node is marked as code or struck out. A struck-out
184
+ * line is a retraction, not a statement.
185
+ * @param {unknown} node - Atlassian Document Format node
186
+ * @returns {boolean} True when some text carries such a mark
187
+ */
188
+ function adfHasNotStatedMark(node) {
189
+ if (!node || typeof node !== "object") return false;
190
+ if (
191
+ Array.isArray(node.marks) &&
192
+ node.marks.some(mark => NOT_STATED_MARKS.has(mark?.type))
193
+ )
194
+ return true;
195
+ return Array.isArray(node.content) && node.content.some(adfHasNotStatedMark);
196
+ }
197
+
198
+ /** Inline children that {@link adfText} renders in full. */
199
+ const TEXT_INLINES = new Set(["text", "hardBreak"]);
200
+
201
+ /**
202
+ * Whether a paragraph holds something visible that {@link adfText} renders as
203
+ * nothing: an inline card, a mention, an emoji, media. A paragraph holding
204
+ * only a card would otherwise become a blank line, and the release after it
205
+ * would read as the comment's first line.
206
+ * @param {unknown} node - Atlassian Document Format paragraph
207
+ * @returns {boolean} True when such a child is present
208
+ */
209
+ function adfHasUnrenderedInline(node) {
210
+ return (
211
+ Array.isArray(node?.content) &&
212
+ node.content.some(child => !TEXT_INLINES.has(child?.type))
213
+ );
214
+ }
215
+
216
+ /**
217
+ * A Jira comment as text, keeping one thing {@link adfText} throws away:
218
+ * whether a block is an ordinary paragraph.
219
+ *
220
+ * A hold release relayed by an automation account counts only as the first
221
+ * line of the comment, written plainly (CodySwannGT/lisa#5190). Flattened, a
222
+ * quoted line, a code block, a list item and a panel all look like that. So
223
+ * every line of a block that is not a plain paragraph (and of a paragraph
224
+ * that carries inline code or a strikethrough, or holds a card, mention, emoji
225
+ * or media that has no text here) is written behind a quote mark. A person's
226
+ * release reads the same as before, because their comment is read generously
227
+ * and a quote mark never hid a marker from it; only a relay, held to the
228
+ * exact form, is refused the quoted copy.
229
+ * @param {unknown} node - Comment body: a document, or text some paths return
230
+ * @returns {string} The comment as text
231
+ */
232
+ export function adfCommentText(node) {
233
+ if (!node || typeof node !== "object" || node.type !== "doc")
234
+ return adfText(node);
235
+ const blocks = Array.isArray(node.content) ? node.content : [];
236
+ return blocks
237
+ .map(block => {
238
+ const plain =
239
+ block?.type === "paragraph" &&
240
+ !adfHasNotStatedMark(block) &&
241
+ !adfHasUnrenderedInline(block);
242
+ const lines = adfText(block).split("\n");
243
+ return (plain ? lines : lines.map(line => `> ${line}`)).join("\n");
244
+ })
245
+ .join("\n");
246
+ }
247
+
179
248
  /**
180
249
  * How many blockers still hold a GitHub issue.
181
250
  *
@@ -19,6 +19,16 @@ cannot discharge a hold. Keep the item held and report the missing authorization
19
19
  replace these inputs with an empty history or an inferred allowlist. Authorized matching releases
20
20
  continue through the existing path and never override an independently declared caller hold.
21
21
 
22
+ One exception is opt-in. A project may name its automation account as a relay (`relay:<account id>`
23
+ in the list of who may release, in its committed settings and never on an instruction given in
24
+ conversation). That account's release then counts when it is the first line of the comment and
25
+ names, before the reason, a trusted person from the same list:
26
+ `[lisa-human-gate-release] relayed-for=<person id> reason=<slug>`. Put any explanation after it;
27
+ a copy that is quoted, in code, or further down the comment releases nothing. Post one only when a trusted person told you to release that hold, and say in the
28
+ comment who asked, where and when. When the project named no relay, do not post a release: tell the
29
+ person at once that it must come from their own tracker login, give them the exact text and a link
30
+ to the item, and never report the item as released (`ready-role-filing`, "Relayed releases").
31
+
22
32
 
23
33
  `$ARGUMENTS` is one of:
24
34
 
@@ -25,6 +25,16 @@ cannot discharge a hold. Keep the item held and report the missing authorization
25
25
  replace these inputs with an empty history or an inferred allowlist. Authorized matching releases
26
26
  continue through the existing path and never override an independently declared caller hold.
27
27
 
28
+ One exception is opt-in. A project may name its automation account as a relay (`relay:<account id>`
29
+ in the list of who may release, in its committed settings and never on an instruction given in
30
+ conversation). That account's release then counts when it is the first line of the comment and
31
+ names, before the reason, a trusted person from the same list:
32
+ `[lisa-human-gate-release] relayed-for=<person id> reason=<slug>`. Put any explanation after it;
33
+ a copy that is quoted, in code, or further down the comment releases nothing. Post one only when a trusted person told you to release that hold, and say in the
34
+ comment who asked, where and when. When the project named no relay, do not post a release: tell the
35
+ person at once that it must come from their own tracker login, give them the exact text and a link
36
+ to the item, and never report the item as released (`ready-role-filing`, "Relayed releases").
37
+
28
38
 
29
39
  Create or update a GitHub Issue with all required relationships, metadata, and quality gates. Every section below is mandatory. Thin issues are rejected.
30
40
 
@@ -378,7 +388,7 @@ If the label does not exist in the tracker, create it, or record that it could n
378
388
  proceed — the marker still holds. Never file the label *instead of* the marker.
379
389
 
380
390
  **Write a `reason=` the release can name.** The hold's reason is not decoration: a hold ends when a
381
- `[lisa-human-gate-release]` comment repeating that same `reason=` is recorded on the item by an authorized human, and the
391
+ `[lisa-human-gate-release]` comment repeating that same `reason=` is recorded on the item by an authorized human (or relayed for one by an account the project named as a relay), and the
382
392
  next intake sweep then takes the marker label off and puts the item back in the build-ready role on
383
393
  its own. Matching is per-reason so that a hold declared *after* an earlier release is not born
384
394
  discharged. A keyless hold is legal and is discharged by a keyless release; a hold whose reason is a
@@ -19,6 +19,16 @@ cannot discharge a hold. Keep the item held and report the missing authorization
19
19
  replace these inputs with an empty history or an inferred allowlist. Authorized matching releases
20
20
  continue through the existing path and never override an independently declared caller hold.
21
21
 
22
+ One exception is opt-in. A project may name its automation account as a relay (`relay:<account id>`
23
+ in the list of who may release, in its committed settings and never on an instruction given in
24
+ conversation). That account's release then counts when it is the first line of the comment and
25
+ names, before the reason, a trusted person from the same list:
26
+ `[lisa-human-gate-release] relayed-for=<person id> reason=<slug>`. Put any explanation after it;
27
+ a copy that is quoted, in code, or further down the comment releases nothing. Post one only when a trusted person told you to release that hold, and say in the
28
+ comment who asked, where and when. When the project named no relay, do not post a release: tell the
29
+ person at once that it must come from their own tracker login, give them the exact text and a link
30
+ to the item, and never report the item as released (`ready-role-filing`, "Relayed releases").
31
+
22
32
 
23
33
  All Atlassian operations in this skill go through `lisa-atlassian-access`. Do not call MCP tools or `acli` directly.
24
34
 
@@ -19,6 +19,8 @@ node /absolute/lisa-secrets-access/scripts/preflight-secrets.mjs --tracker-intak
19
19
  node /absolute/lisa-secrets-access/scripts/preflight-secrets.mjs --tracker-intake-read --ref PROJ-123 --read comments
20
20
  ```
21
21
 
22
+ The same two commands are the read for a session with no ticket bound, for example a question about an issue: the task-readiness guard admits them, and its `work-item-unbound` refusal names them with the installed path. Do not bind a ticket just to read one.
23
+
22
24
  The token route returns the full issue and remote links, and the comments command reads all pages in order. If the token is unavailable, the command can read the issue through an already authenticated `acli` session on the configured site. That route reports `remoteLinks: null` and returns comments only when the embedded page is complete. Use the Atlassian access owner's native Jira issue and remote-link reads against the configured cloud and issue key to fill missing data. Check the embedded comment total before treating native context as complete.
23
25
 
24
26
  ## Phase 1 — Resolve Context
@@ -25,6 +25,16 @@ cannot discharge a hold. Keep the item held and report the missing authorization
25
25
  replace these inputs with an empty history or an inferred allowlist. Authorized matching releases
26
26
  continue through the existing path and never override an independently declared caller hold.
27
27
 
28
+ One exception is opt-in. A project may name its automation account as a relay (`relay:<account id>`
29
+ in the list of who may release, in its committed settings and never on an instruction given in
30
+ conversation). That account's release then counts when it is the first line of the comment and
31
+ names, before the reason, a trusted person from the same list:
32
+ `[lisa-human-gate-release] relayed-for=<person id> reason=<slug>`. Put any explanation after it;
33
+ a copy that is quoted, in code, or further down the comment releases nothing. Post one only when a trusted person told you to release that hold, and say in the
34
+ comment who asked, where and when. When the project named no relay, do not post a release: tell the
35
+ person at once that it must come from their own tracker login, give them the exact text and a link
36
+ to the item, and never report the item as released (`ready-role-filing`, "Relayed releases").
37
+
28
38
 
29
39
  All Atlassian operations in this skill go through `lisa-atlassian-access`. Do not call MCP tools or `acli` directly.
30
40
 
@@ -363,7 +373,7 @@ If the label does not exist in the tracker, create it, or record that it could n
363
373
  proceed — the marker still holds. Never file the label *instead of* the marker.
364
374
 
365
375
  **Write a `reason=` the release can name.** The hold's reason is not decoration: a hold ends when a
366
- `[lisa-human-gate-release]` comment repeating that same `reason=` is recorded on the item by an authorized human, and the
376
+ `[lisa-human-gate-release]` comment repeating that same `reason=` is recorded on the item by an authorized human (or relayed for one by an account the project named as a relay), and the
367
377
  next intake sweep then takes the marker label off and puts the item back in the build-ready role on
368
378
  its own. Matching is per-reason so that a hold declared *after* an earlier release is not born
369
379
  discharged. A keyless hold is legal and is discharged by a keyless release; a hold whose reason is a
@@ -19,6 +19,16 @@ cannot discharge a hold. Keep the item held and report the missing authorization
19
19
  replace these inputs with an empty history or an inferred allowlist. Authorized matching releases
20
20
  continue through the existing path and never override an independently declared caller hold.
21
21
 
22
+ One exception is opt-in. A project may name its automation account as a relay (`relay:<account id>`
23
+ in the list of who may release, in its committed settings and never on an instruction given in
24
+ conversation). That account's release then counts when it is the first line of the comment and
25
+ names, before the reason, a trusted person from the same list:
26
+ `[lisa-human-gate-release] relayed-for=<person id> reason=<slug>`. Put any explanation after it;
27
+ a copy that is quoted, in code, or further down the comment releases nothing. Post one only when a trusted person told you to release that hold, and say in the
28
+ comment who asked, where and when. When the project named no relay, do not post a release: tell the
29
+ person at once that it must come from their own tracker login, give them the exact text and a link
30
+ to the item, and never report the item as released (`ready-role-filing`, "Relayed releases").
31
+
22
32
 
23
33
  `$ARGUMENTS` is one of:
24
34
 
@@ -25,6 +25,8 @@ node /absolute/lisa-secrets-access/scripts/preflight-secrets.mjs --tracker-intak
25
25
  node /absolute/lisa-secrets-access/scripts/preflight-secrets.mjs --tracker-intake-read --ref ENG-123 --read comments
26
26
  ```
27
27
 
28
+ The same two commands are the read for a session with no ticket bound, for example a question about an issue: the task-readiness guard admits them, and its `work-item-unbound` refusal names them with the installed path. Do not bind a ticket just to read one.
29
+
28
30
  The issue response includes the primary body, team, and related graph fields. The comments command returns the entire paginated comment list or fails. Fetch related issues in the configured team with the same command and their issue keys. If a graph field reports another page, record the context as incomplete until those related records can be read through the access owner.
29
31
 
30
32
  If the token route is unavailable, load `lisa-linear-access` and use its native Linear MCP fallback. List teams with the configured team key as `query`, verify the configured workspace and team, then read the issue by its key. Use the resulting issue identifier or UUID for the comment pages. This read-only path leaves the requirements header and access check to the normal task flow.
@@ -25,6 +25,16 @@ cannot discharge a hold. Keep the item held and report the missing authorization
25
25
  replace these inputs with an empty history or an inferred allowlist. Authorized matching releases
26
26
  continue through the existing path and never override an independently declared caller hold.
27
27
 
28
+ One exception is opt-in. A project may name its automation account as a relay (`relay:<account id>`
29
+ in the list of who may release, in its committed settings and never on an instruction given in
30
+ conversation). That account's release then counts when it is the first line of the comment and
31
+ names, before the reason, a trusted person from the same list:
32
+ `[lisa-human-gate-release] relayed-for=<person id> reason=<slug>`. Put any explanation after it;
33
+ a copy that is quoted, in code, or further down the comment releases nothing. Post one only when a trusted person told you to release that hold, and say in the
34
+ comment who asked, where and when. When the project named no relay, do not post a release: tell the
35
+ person at once that it must come from their own tracker login, give them the exact text and a link
36
+ to the item, and never report the item as released (`ready-role-filing`, "Relayed releases").
37
+
28
38
 
29
39
  Create or update a Linear work item — Project (for Epics), Issue (for Stories), or sub-Issue (for Sub-tasks) — with all required relationships, metadata, and quality gates. Every section below is mandatory. Thin items are rejected.
30
40
 
@@ -364,7 +374,7 @@ proceed — the marker still holds. Never file the label *instead of* the marker
364
374
  **Every marker reader must consult comments.** Use `classifyReadyCandidate` with labels, body, comments, the configured human-needed label, `humanOnly` and `humanGateMode` (from `humanGate.mode`), then `planHumanGateRelease` for any release actions. A historical body marker alone is not an active hold after its matching release; unreadable comments leave a hold in place.
365
375
 
366
376
  **Write a `reason=` the release can name.** The hold's reason is not decoration: a hold ends when a
367
- `[lisa-human-gate-release]` comment repeating that same `reason=` is recorded on the item by an authorized human, and the
377
+ `[lisa-human-gate-release]` comment repeating that same `reason=` is recorded on the item by an authorized human (or relayed for one by an account the project named as a relay), and the
368
378
  next intake sweep then takes the marker label off and puts the item back in the build-ready role on
369
379
  its own. Matching is per-reason so that a hold declared *after* an earlier release is not born
370
380
  discharged. A keyless hold is legal and is discharged by a keyless release; a hold whose reason is a
@@ -19,6 +19,16 @@ cannot discharge a hold. Keep the item held and report the missing authorization
19
19
  replace these inputs with an empty history or an inferred allowlist. Authorized matching releases
20
20
  continue through the existing path and never override an independently declared caller hold.
21
21
 
22
+ One exception is opt-in. A project may name its automation account as a relay (`relay:<account id>`
23
+ in the list of who may release, in its committed settings and never on an instruction given in
24
+ conversation). That account's release then counts when it is the first line of the comment and
25
+ names, before the reason, a trusted person from the same list:
26
+ `[lisa-human-gate-release] relayed-for=<person id> reason=<slug>`. Put any explanation after it;
27
+ a copy that is quoted, in code, or further down the comment releases nothing. Post one only when a trusted person told you to release that hold, and say in the
28
+ comment who asked, where and when. When the project named no relay, do not post a release: tell the
29
+ person at once that it must come from their own tracker login, give them the exact text and a link
30
+ to the item, and never report the item as released (`ready-role-filing`, "Relayed releases").
31
+
22
32
 
23
33
  Run one batch-**repair** cycle against the queue identified by `$ARGUMENTS`, or by merged GitHub
24
34
  config when the queue is omitted and a GitHub source/tracker default is resolvable. Where `lisa-intake`
@@ -9,6 +9,7 @@ import { readTaskRequirements } from "./task-requirements.mjs";
9
9
  import { lifecycleEvents, resetNativeEvent } from "./task-native-lifecycle.mjs";
10
10
  import { intakeRead } from "./task-intake.mjs";
11
11
  import { nativeContext } from "./task-native-context.mjs";
12
+ import { unboundRefusal, unboundWrite } from "./task-unbound.mjs";
12
13
  import {
13
14
  linearIntakeRead,
14
15
  observeLinearIntake,
@@ -177,7 +178,8 @@ export function runTaskAction(argv = process.argv) {
177
178
  result = failure("requirements-stale");
178
179
  else if (hook && result.code === "no-active-task") {
179
180
  if (cfg.provenance?.status === "absent") return;
180
- result = failure("requirements-stale");
181
+ if (unboundWrite(input, cfg)) return;
182
+ result = unboundRefusal(cfg);
181
183
  } else if (hook && result.outcome === "NATIVE_OWNER_REQUIRED") {
182
184
  const decision = nativeAction(cfg, header, result, input);
183
185
  if (decision.allowed) result = { allowed: true, code: decision.code };
@@ -90,19 +90,29 @@ export function writeRequirementsContext(
90
90
  if (error.code !== "ENOENT") fail();
91
91
  initial = true;
92
92
  }
93
+ const freshBody =
94
+ typeof input.context_body === "string" &&
95
+ !input.context_body.startsWith(marker);
96
+ // Re-binding the checkout to another item leaves the previous item's
97
+ // context behind. With the binding already naming `ref`, that context
98
+ // belongs to no current work: a fresh body for `ref` replaces it, so the
99
+ // prepare step that follows a re-bind does not dead-end the session.
100
+ let replacing = false;
93
101
  if (initial) {
94
- if (
95
- typeof input.context_body !== "string" ||
96
- input.context_body.startsWith(marker)
97
- )
98
- fail();
102
+ if (!freshBody) fail();
99
103
  } else {
100
104
  try {
101
- if (realpathSync(path) !== path || input.context_body !== undefined)
102
- fail();
105
+ if (realpathSync(path) !== path) fail();
103
106
  } catch {
104
107
  fail();
105
108
  }
109
+ const previous = previousItem(readFileSync(path, "utf8"), marker);
110
+ replacing =
111
+ freshBody &&
112
+ binding?.ref === ref &&
113
+ previous !== null &&
114
+ previous !== ref;
115
+ if (input.context_body !== undefined && !replacing) fail();
106
116
  }
107
117
  const eas = join(cfg.projectRoot, ".easignore");
108
118
  if (
@@ -113,7 +123,8 @@ export function writeRequirementsContext(
113
123
  )
114
124
  fail();
115
125
  ensureIgnored(cfg.projectRoot);
116
- let body = initial ? input.context_body : readFileSync(path, "utf8");
126
+ let body =
127
+ initial || replacing ? input.context_body : readFileSync(path, "utf8");
117
128
  if (body.startsWith(marker)) {
118
129
  const end = body.indexOf("\n-->\n");
119
130
  if (end < 0) fail();
@@ -154,5 +165,25 @@ export function writeRequirementsContext(
154
165
  } finally {
155
166
  rmSync(staging, { recursive: true, force: true });
156
167
  }
157
- return { code: "requirements-prepared", body_preserved: true };
168
+ return { code: "requirements-prepared", body_preserved: !replacing };
169
+ }
170
+
171
+ /**
172
+ * The work item a prepared context names, or null when it names none.
173
+ * @param {string} current The context file's text.
174
+ * @param {string} marker The requirements header's opening line.
175
+ * @returns {string|null} The previous work item reference.
176
+ */
177
+ function previousItem(current, marker) {
178
+ if (!current.startsWith(marker)) return null;
179
+ const end = current.indexOf("\n-->\n");
180
+ if (end < 0) return null;
181
+ try {
182
+ const header = JSON.parse(current.slice(marker.length, end));
183
+ return typeof header?.work_item_ref === "string"
184
+ ? header.work_item_ref
185
+ : null;
186
+ } catch {
187
+ return null;
188
+ }
158
189
  }
@@ -0,0 +1,169 @@
1
+ /**
2
+ * What a session with no work item bound may still do, and what it is told.
3
+ *
4
+ * With no binding and no prepared context there is no task whose access could
5
+ * be proved, so the guard refuses project work. Two things are not project
6
+ * work and stay possible: reading (the fixed read commands the guard already
7
+ * admits), and writing a file that lands in no git repository at all, such as
8
+ * an agent's scratch or memory file. The refusal names the read command for
9
+ * this installation, because an agent cannot guess an absolute plugin path.
10
+ */
11
+ import { existsSync, realpathSync, statSync } from "node:fs";
12
+ import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
13
+ import { fileURLToPath } from "node:url";
14
+ import {
15
+ configuredIssueRepository,
16
+ issueFields,
17
+ } from "../../lisa-github-read-issue/read-contract.mjs";
18
+
19
+ const owner = join(
20
+ dirname(fileURLToPath(import.meta.url)),
21
+ "preflight-secrets.mjs"
22
+ );
23
+ const FILE_TOOLS = new Set(["Write", "Edit", "MultiEdit", "write", "edit"]);
24
+ const PATCH_TARGET =
25
+ /^\*\*\* (?:Add File|Update File|Delete File|Move to): (.*)$/;
26
+
27
+ /**
28
+ * The real location a path would be written to: the deepest existing
29
+ * ancestor's real path, with the not-yet-existing remainder appended.
30
+ * @param {string} target Absolute path.
31
+ * @returns {string|null} Resolved location, or null when unresolvable.
32
+ */
33
+ function realLocation(target) {
34
+ let existing = target;
35
+ while (!existsSync(existing)) {
36
+ const parent = dirname(existing);
37
+ if (parent === existing) return null;
38
+ existing = parent;
39
+ }
40
+ try {
41
+ return join(realpathSync(existing), relative(existing, target));
42
+ } catch {
43
+ return null;
44
+ }
45
+ }
46
+
47
+ /**
48
+ * Whether any directory from `location` up to the root holds `.git`.
49
+ * @param {string} location Resolved absolute path.
50
+ * @returns {boolean} True when the path is inside a git repository.
51
+ */
52
+ function insideRepository(location) {
53
+ for (let dir = location; ; dir = dirname(dir)) {
54
+ try {
55
+ statSync(join(dir, ".git"));
56
+ return true;
57
+ } catch (error) {
58
+ if (!["ENOENT", "ENOTDIR"].includes(error.code)) return true;
59
+ }
60
+ if (dirname(dir) === dir) return false;
61
+ }
62
+ }
63
+
64
+ /**
65
+ * Whether a write to `target` changes no project: it resolves outside the
66
+ * project and outside every git repository. Any doubt is a refusal.
67
+ * @param {unknown} target The path the tool names.
68
+ * @param {string} projectRoot This project's root.
69
+ * @returns {boolean} True when the write touches no repository.
70
+ */
71
+ export function outsideEveryRepository(target, projectRoot) {
72
+ if (typeof target !== "string" || !isAbsolute(target)) return false;
73
+ const location = realLocation(resolve(target));
74
+ if (!location) return false;
75
+ let root;
76
+ try {
77
+ root = realpathSync(projectRoot);
78
+ } catch {
79
+ return false;
80
+ }
81
+ if (location === root || location.startsWith(root + sep)) return false;
82
+ return !insideRepository(location);
83
+ }
84
+
85
+ /**
86
+ * Every path a file-writing tool call names, or null for any other shape.
87
+ * @param {Record<string, any>} input Hook event.
88
+ * @returns {string[]|null} Target paths.
89
+ */
90
+ function writeTargets(input) {
91
+ const args = input?.tool_input;
92
+ if (!args || typeof args !== "object") return null;
93
+ if (FILE_TOOLS.has(input.tool_name)) {
94
+ const target = args.file_path ?? args.filePath;
95
+ return typeof target === "string" ? [target] : null;
96
+ }
97
+ if (input.tool_name === "NotebookEdit")
98
+ return typeof args.notebook_path === "string" ? [args.notebook_path] : null;
99
+ if (input.tool_name === "apply_patch" && typeof args.command === "string") {
100
+ const targets = args.command
101
+ .split("\n")
102
+ .map(line => PATCH_TARGET.exec(line)?.[1])
103
+ .filter(Boolean);
104
+ return targets.length ? targets : null;
105
+ }
106
+ return null;
107
+ }
108
+
109
+ /**
110
+ * Whether an unbound session's tool call only writes outside every repository.
111
+ * @param {Record<string, any>} input Hook event.
112
+ * @param {{projectRoot: string}} cfg Task configuration.
113
+ * @returns {boolean} True to admit it.
114
+ */
115
+ export function unboundWrite(input, cfg) {
116
+ const targets = writeTargets(input);
117
+ return (
118
+ targets !== null &&
119
+ targets.every(target => outsideEveryRepository(target, cfg.projectRoot))
120
+ );
121
+ }
122
+
123
+ /**
124
+ * The exact read command this installation admits with no work item bound.
125
+ * @param {Record<string, any>} cfg Task configuration.
126
+ * @returns {string|null} Command text with a placeholder ticket, or null.
127
+ */
128
+ function readCommand(cfg) {
129
+ const c = cfg.effective ?? {};
130
+ const script = /^[\w./@+-]+$/.test(owner)
131
+ ? owner
132
+ : `'${owner.replaceAll("'", "'\\''")}'`;
133
+ if (c.tracker === "linear" && c.linear?.teamKey)
134
+ return `node ${script} --tracker-intake-read --ref ${c.linear.teamKey}-<number> --read issue`;
135
+ if (c.tracker === "jira" && c.jira?.project)
136
+ return `node ${script} --tracker-intake-read --ref ${c.jira.project}-<number> --read issue`;
137
+ const repo = c.github && configuredIssueRepository(c.github);
138
+ if (repo && (!c.tracker || c.tracker === "github"))
139
+ return `gh issue view <number> --repo ${repo} --json ${issueFields}`;
140
+ return null;
141
+ }
142
+
143
+ /**
144
+ * The refusal for a session with no work item bound, in plain English.
145
+ * @param {Record<string, any>} cfg Task configuration.
146
+ * @returns {{allowed: false, code: string, action: string}} Refusal.
147
+ */
148
+ export function unboundRefusal(cfg) {
149
+ const read = readCommand(cfg);
150
+ const comments =
151
+ read && read.includes("--read issue")
152
+ ? " Use `--read comments` for its comments."
153
+ : "";
154
+ return {
155
+ allowed: false,
156
+ code: "work-item-unbound",
157
+ action: [
158
+ "No work item is bound to this checkout, so only reading is allowed.",
159
+ "Read files with the Read, Grep and Glob tools.",
160
+ read
161
+ ? `Read a ticket with exactly this command, with the ticket's number in place of <number>: ${read}.${comments}`
162
+ : "",
163
+ "A file written outside every git repository, such as a scratch or memory file, is allowed.",
164
+ "To change anything in this project, bind its ticket first with lisa-track.",
165
+ ]
166
+ .filter(Boolean)
167
+ .join(" "),
168
+ };
169
+ }