@intentic/sandbox-contract 1.430.0 → 1.432.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (711) hide show
  1. package/README.md +22 -5
  2. package/dist/app-routes/app-pages.d.ts +1 -0
  3. package/dist/app-routes/app-pages.d.ts.map +1 -1
  4. package/dist/app-routes/app-pages.js +1 -0
  5. package/dist/app-routes/app-pages.js.map +1 -1
  6. package/dist/app-routes/index.d.ts +1 -0
  7. package/dist/app-routes/index.d.ts.map +1 -1
  8. package/dist/app-routes/index.js +1 -0
  9. package/dist/app-routes/index.js.map +1 -1
  10. package/dist/app-routes/return-path.d.ts +2 -0
  11. package/dist/app-routes/return-path.d.ts.map +1 -0
  12. package/dist/app-routes/return-path.js +8 -0
  13. package/dist/app-routes/return-path.js.map +1 -0
  14. package/dist/briefs/agent-ask.d.ts +10 -0
  15. package/dist/briefs/agent-ask.d.ts.map +1 -0
  16. package/dist/briefs/agent-ask.js +2 -0
  17. package/dist/briefs/agent-ask.js.map +1 -0
  18. package/dist/{chores/extension-update.d.ts → briefs/extension-update-brief.d.ts} +1 -1
  19. package/dist/briefs/extension-update-brief.d.ts.map +1 -0
  20. package/dist/{chores/extension-update.js → briefs/extension-update-brief.js} +2 -2
  21. package/dist/briefs/extension-update-brief.js.map +1 -0
  22. package/dist/chores/digest.d.ts.map +1 -1
  23. package/dist/chores/digest.js.map +1 -1
  24. package/dist/chores/index.d.ts +2 -2
  25. package/dist/chores/index.d.ts.map +1 -1
  26. package/dist/chores/index.js +1 -1
  27. package/dist/chores/index.js.map +1 -1
  28. package/dist/chores/prompt.d.ts +1 -9
  29. package/dist/chores/prompt.d.ts.map +1 -1
  30. package/dist/chores/prompt.js +1 -1
  31. package/dist/chores/prompt.js.map +1 -1
  32. package/dist/chores/stack.d.ts.map +1 -1
  33. package/dist/chores/stack.js.map +1 -1
  34. package/dist/chores/verdict.d.ts.map +1 -1
  35. package/dist/chores/verdict.js.map +1 -1
  36. package/dist/chores/workspace-scope.d.ts +1 -3
  37. package/dist/chores/workspace-scope.d.ts.map +1 -1
  38. package/dist/chores/workspace-scope.js +1 -3
  39. package/dist/chores/workspace-scope.js.map +1 -1
  40. package/dist/contracts/accounts.contract.d.ts.map +1 -1
  41. package/dist/contracts/accounts.contract.js +2 -0
  42. package/dist/contracts/accounts.contract.js.map +1 -1
  43. package/dist/contracts/agent.contract.d.ts +1226 -12
  44. package/dist/contracts/agent.contract.d.ts.map +1 -1
  45. package/dist/contracts/agents.contract.d.ts +2665 -733
  46. package/dist/contracts/agents.contract.d.ts.map +1 -1
  47. package/dist/contracts/agents.contract.js +35 -5
  48. package/dist/contracts/agents.contract.js.map +1 -1
  49. package/dist/contracts/automations.contract.d.ts +90 -8
  50. package/dist/contracts/automations.contract.d.ts.map +1 -1
  51. package/dist/contracts/automations.contract.js +1 -0
  52. package/dist/contracts/automations.contract.js.map +1 -1
  53. package/dist/contracts/capabilities.contract.d.ts +49 -0
  54. package/dist/contracts/capabilities.contract.d.ts.map +1 -1
  55. package/dist/contracts/capabilities.contract.js +24 -1
  56. package/dist/contracts/capabilities.contract.js.map +1 -1
  57. package/dist/contracts/ci.contract.d.ts +222 -95
  58. package/dist/contracts/ci.contract.d.ts.map +1 -1
  59. package/dist/contracts/ci.contract.js +87 -26
  60. package/dist/contracts/ci.contract.js.map +1 -1
  61. package/dist/contracts/device-ci-runners.contract.d.ts +108 -0
  62. package/dist/contracts/device-ci-runners.contract.d.ts.map +1 -0
  63. package/dist/contracts/device-ci-runners.contract.js +56 -0
  64. package/dist/contracts/device-ci-runners.contract.js.map +1 -0
  65. package/dist/contracts/device-stacks.contract.d.ts +129 -0
  66. package/dist/contracts/device-stacks.contract.d.ts.map +1 -0
  67. package/dist/contracts/device-stacks.contract.js +66 -0
  68. package/dist/contracts/device-stacks.contract.js.map +1 -0
  69. package/dist/contracts/device.contract.d.ts +74 -0
  70. package/dist/contracts/device.contract.d.ts.map +1 -1
  71. package/dist/contracts/extensions.contract.d.ts +604 -0
  72. package/dist/contracts/extensions.contract.d.ts.map +1 -1
  73. package/dist/contracts/extensions.contract.js +11 -2
  74. package/dist/contracts/extensions.contract.js.map +1 -1
  75. package/dist/contracts/git.contract.d.ts +7 -0
  76. package/dist/contracts/git.contract.d.ts.map +1 -1
  77. package/dist/contracts/needs.contract.d.ts +1097 -18
  78. package/dist/contracts/needs.contract.d.ts.map +1 -1
  79. package/dist/contracts/offload.contract.d.ts +25 -0
  80. package/dist/contracts/offload.contract.d.ts.map +1 -1
  81. package/dist/contracts/ports.contract.d.ts +8 -0
  82. package/dist/contracts/ports.contract.d.ts.map +1 -1
  83. package/dist/contracts/ports.contract.js +6 -5
  84. package/dist/contracts/ports.contract.js.map +1 -1
  85. package/dist/contracts/remote.contract.d.ts +1 -0
  86. package/dist/contracts/remote.contract.d.ts.map +1 -1
  87. package/dist/contracts/runner.contract.d.ts +1203 -9
  88. package/dist/contracts/runner.contract.d.ts.map +1 -1
  89. package/dist/contracts/runner.contract.js +49 -2
  90. package/dist/contracts/runner.contract.js.map +1 -1
  91. package/dist/contracts/runners.contract.d.ts +16 -0
  92. package/dist/contracts/runners.contract.d.ts.map +1 -0
  93. package/dist/contracts/runners.contract.js +15 -0
  94. package/dist/contracts/runners.contract.js.map +1 -0
  95. package/dist/contracts/safety.contract.d.ts.map +1 -1
  96. package/dist/contracts/safety.contract.js +1 -0
  97. package/dist/contracts/safety.contract.js.map +1 -1
  98. package/dist/contracts/seal.contract.d.ts +100 -0
  99. package/dist/contracts/seal.contract.d.ts.map +1 -1
  100. package/dist/contracts/secrets.contract.d.ts +15 -0
  101. package/dist/contracts/secrets.contract.d.ts.map +1 -1
  102. package/dist/contracts/secrets.contract.js +27 -1
  103. package/dist/contracts/secrets.contract.js.map +1 -1
  104. package/dist/contracts/sessions.contract.d.ts +159 -2
  105. package/dist/contracts/sessions.contract.d.ts.map +1 -1
  106. package/dist/contracts/settings.contract.d.ts +59 -42
  107. package/dist/contracts/settings.contract.d.ts.map +1 -1
  108. package/dist/contracts/settings.contract.js +19 -0
  109. package/dist/contracts/settings.contract.js.map +1 -1
  110. package/dist/contracts/skills.contract.d.ts +6 -0
  111. package/dist/contracts/skills.contract.d.ts.map +1 -1
  112. package/dist/contracts/stack-grants.contract.d.ts +418 -0
  113. package/dist/contracts/stack-grants.contract.d.ts.map +1 -0
  114. package/dist/contracts/stack-grants.contract.js +46 -0
  115. package/dist/contracts/stack-grants.contract.js.map +1 -0
  116. package/dist/contracts/system.contract.d.ts +516 -69
  117. package/dist/contracts/system.contract.d.ts.map +1 -1
  118. package/dist/contracts/system.contract.js +26 -45
  119. package/dist/contracts/system.contract.js.map +1 -1
  120. package/dist/contracts/usage.contract.d.ts +3 -0
  121. package/dist/contracts/usage.contract.d.ts.map +1 -1
  122. package/dist/contracts/workspace.contract.d.ts +0 -55
  123. package/dist/contracts/workspace.contract.d.ts.map +1 -1
  124. package/dist/contracts/workspace.contract.js +0 -19
  125. package/dist/contracts/workspace.contract.js.map +1 -1
  126. package/dist/events/agent-events.d.ts +615 -8
  127. package/dist/events/agent-events.d.ts.map +1 -1
  128. package/dist/events/agent-events.js +2 -2
  129. package/dist/events/agent-events.js.map +1 -1
  130. package/dist/events/agent-transcript.d.ts +159 -2
  131. package/dist/events/agent-transcript.d.ts.map +1 -1
  132. package/dist/events/agent-words.d.ts +5 -0
  133. package/dist/events/agent-words.d.ts.map +1 -1
  134. package/dist/events/agent-words.js +22 -2
  135. package/dist/events/agent-words.js.map +1 -1
  136. package/dist/events/child-news.d.ts +32 -0
  137. package/dist/events/child-news.d.ts.map +1 -0
  138. package/dist/events/child-news.js +171 -0
  139. package/dist/events/child-news.js.map +1 -0
  140. package/dist/events/prompt-origins.d.ts +42 -0
  141. package/dist/events/prompt-origins.d.ts.map +1 -1
  142. package/dist/events/prompt-origins.js +28 -0
  143. package/dist/events/prompt-origins.js.map +1 -1
  144. package/dist/events/refusal-incidents.d.ts +1 -0
  145. package/dist/events/refusal-incidents.d.ts.map +1 -1
  146. package/dist/events/refusal-incidents.js +42 -19
  147. package/dist/events/refusal-incidents.js.map +1 -1
  148. package/dist/events/requests.d.ts +14 -0
  149. package/dist/events/requests.d.ts.map +1 -1
  150. package/dist/events/requests.js +12 -0
  151. package/dist/events/requests.js.map +1 -1
  152. package/dist/events/system-events.d.ts +98 -0
  153. package/dist/events/system-events.d.ts.map +1 -1
  154. package/dist/events/transcript.d.ts +799 -10
  155. package/dist/events/transcript.d.ts.map +1 -1
  156. package/dist/events/transcript.js +2 -1
  157. package/dist/events/transcript.js.map +1 -1
  158. package/dist/ids/conversation-ids.d.ts +1 -0
  159. package/dist/ids/conversation-ids.d.ts.map +1 -1
  160. package/dist/ids/conversation-ids.js +2 -1
  161. package/dist/ids/conversation-ids.js.map +1 -1
  162. package/dist/ids/project-id.d.ts.map +1 -1
  163. package/dist/ids/project-id.js +4 -4
  164. package/dist/ids/project-id.js.map +1 -1
  165. package/dist/ids/run-row-ids.d.ts +8 -0
  166. package/dist/ids/run-row-ids.d.ts.map +1 -0
  167. package/dist/ids/run-row-ids.js +32 -0
  168. package/dist/ids/run-row-ids.js.map +1 -0
  169. package/dist/index.d.ts +4 -4
  170. package/dist/index.d.ts.map +1 -1
  171. package/dist/index.js +4 -4
  172. package/dist/index.js.map +1 -1
  173. package/dist/models/agent-catalog.d.ts.map +1 -1
  174. package/dist/models/agent-catalog.js +3 -2
  175. package/dist/models/agent-catalog.js.map +1 -1
  176. package/dist/models/agent-lanes.d.ts.map +1 -1
  177. package/dist/models/agent-lanes.js +4 -1
  178. package/dist/models/agent-lanes.js.map +1 -1
  179. package/dist/models/agent-runtimes.d.ts.map +1 -1
  180. package/dist/models/agent-runtimes.js +2 -2
  181. package/dist/models/agent-runtimes.js.map +1 -1
  182. package/dist/models/agent-standing.d.ts +6 -1
  183. package/dist/models/agent-standing.d.ts.map +1 -1
  184. package/dist/models/agent-standing.js +1 -0
  185. package/dist/models/agent-standing.js.map +1 -1
  186. package/dist/models/model-roles.d.ts +91 -37
  187. package/dist/models/model-roles.d.ts.map +1 -1
  188. package/dist/models/model-roles.js +106 -35
  189. package/dist/models/model-roles.js.map +1 -1
  190. package/dist/models/model-setups.d.ts +10 -8
  191. package/dist/models/model-setups.d.ts.map +1 -1
  192. package/dist/models/model-setups.js +15 -15
  193. package/dist/models/model-setups.js.map +1 -1
  194. package/dist/models/providers/provider-traits.d.ts +215 -0
  195. package/dist/models/providers/provider-traits.d.ts.map +1 -0
  196. package/dist/models/providers/provider-traits.js +60 -0
  197. package/dist/models/providers/provider-traits.js.map +1 -0
  198. package/dist/netd/browser-wire.d.ts +8 -0
  199. package/dist/netd/browser-wire.d.ts.map +1 -1
  200. package/dist/netd/browser-wire.js +5 -0
  201. package/dist/netd/browser-wire.js.map +1 -1
  202. package/dist/netd/generated/wire.d.ts +42 -1
  203. package/dist/netd/generated/wire.d.ts.map +1 -1
  204. package/dist/policy/admin/admin-grant.d.ts +21 -0
  205. package/dist/policy/admin/admin-grant.d.ts.map +1 -0
  206. package/dist/policy/admin/admin-grant.js +41 -0
  207. package/dist/policy/admin/admin-grant.js.map +1 -0
  208. package/dist/policy/approvals-execution.d.ts +5 -2
  209. package/dist/policy/approvals-execution.d.ts.map +1 -1
  210. package/dist/policy/approvals-execution.js +3 -4
  211. package/dist/policy/approvals-execution.js.map +1 -1
  212. package/dist/policy/batch-runs.d.ts +1 -1
  213. package/dist/policy/batch-runs.d.ts.map +1 -1
  214. package/dist/policy/batch-runs.js +2 -1
  215. package/dist/policy/batch-runs.js.map +1 -1
  216. package/dist/policy/capabilities/capability-kinds.d.ts +268 -0
  217. package/dist/policy/capabilities/capability-kinds.d.ts.map +1 -0
  218. package/dist/policy/capabilities/capability-kinds.js +47 -0
  219. package/dist/policy/capabilities/capability-kinds.js.map +1 -0
  220. package/dist/policy/command-classes.d.ts.map +1 -1
  221. package/dist/policy/command-classes.js +3 -1
  222. package/dist/policy/command-classes.js.map +1 -1
  223. package/dist/policy/device-programs.d.ts +79 -2
  224. package/dist/policy/device-programs.d.ts.map +1 -1
  225. package/dist/policy/device-programs.js +15 -16
  226. package/dist/policy/device-programs.js.map +1 -1
  227. package/dist/policy/message-limits.d.ts.map +1 -1
  228. package/dist/policy/message-limits.js.map +1 -1
  229. package/dist/policy/org-locks.d.ts +1 -1
  230. package/dist/policy/org-locks.d.ts.map +1 -1
  231. package/dist/policy/org-locks.js +1 -0
  232. package/dist/policy/org-locks.js.map +1 -1
  233. package/dist/policy/reserved-servers.d.ts.map +1 -1
  234. package/dist/policy/reserved-servers.js +5 -1
  235. package/dist/policy/reserved-servers.js.map +1 -1
  236. package/dist/policy/role-capability.d.ts.map +1 -1
  237. package/dist/policy/role-capability.js +2 -1
  238. package/dist/policy/role-capability.js.map +1 -1
  239. package/dist/policy/shell/command-normalise.d.ts +10 -0
  240. package/dist/policy/shell/command-normalise.d.ts.map +1 -0
  241. package/dist/policy/shell/command-normalise.js +153 -0
  242. package/dist/policy/shell/command-normalise.js.map +1 -0
  243. package/dist/policy/shell/workspace-root-exclude.d.ts +4 -0
  244. package/dist/policy/shell/workspace-root-exclude.d.ts.map +1 -0
  245. package/dist/policy/shell/workspace-root-exclude.js +4 -0
  246. package/dist/policy/shell/workspace-root-exclude.js.map +1 -0
  247. package/dist/protocol/doors/listener-protocol.d.ts +11 -0
  248. package/dist/protocol/doors/listener-protocol.d.ts.map +1 -1
  249. package/dist/protocol/doors/listener-protocol.js +5 -0
  250. package/dist/protocol/doors/listener-protocol.js.map +1 -1
  251. package/dist/protocol/doors/loopback-proof.d.ts +8 -0
  252. package/dist/protocol/doors/loopback-proof.d.ts.map +1 -0
  253. package/dist/protocol/doors/loopback-proof.js +11 -0
  254. package/dist/protocol/doors/loopback-proof.js.map +1 -0
  255. package/dist/protocol/doors/pass-scopes.d.ts +4 -0
  256. package/dist/protocol/doors/pass-scopes.d.ts.map +1 -0
  257. package/dist/protocol/doors/pass-scopes.js +3 -0
  258. package/dist/protocol/doors/pass-scopes.js.map +1 -0
  259. package/dist/protocol/doors/runner-protocol.d.ts +187 -0
  260. package/dist/protocol/doors/runner-protocol.d.ts.map +1 -1
  261. package/dist/protocol/doors/runner-protocol.js +48 -1
  262. package/dist/protocol/doors/runner-protocol.js.map +1 -1
  263. package/dist/protocol/doors/sandbox-pass.d.ts +19 -2
  264. package/dist/protocol/doors/sandbox-pass.d.ts.map +1 -1
  265. package/dist/protocol/doors/sandbox-pass.js +42 -10
  266. package/dist/protocol/doors/sandbox-pass.js.map +1 -1
  267. package/dist/protocol/doors/webext-links.d.ts.map +1 -1
  268. package/dist/protocol/doors/webext-links.js.map +1 -1
  269. package/dist/protocol/member-reach.d.ts +6 -0
  270. package/dist/protocol/member-reach.d.ts.map +1 -1
  271. package/dist/protocol/member-reach.js +24 -0
  272. package/dist/protocol/member-reach.js.map +1 -1
  273. package/dist/protocol/peer-mcp-server.d.ts +2 -0
  274. package/dist/protocol/peer-mcp-server.d.ts.map +1 -1
  275. package/dist/protocol/peer-mcp-server.js +1 -0
  276. package/dist/protocol/peer-mcp-server.js.map +1 -1
  277. package/dist/protocol/raw/extension-protocol.d.ts +518 -0
  278. package/dist/protocol/raw/extension-protocol.d.ts.map +1 -1
  279. package/dist/protocol/raw/extension-protocol.js +276 -0
  280. package/dist/protocol/raw/extension-protocol.js.map +1 -1
  281. package/dist/protocol/raw/raw-json-routes.d.ts +572 -0
  282. package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
  283. package/dist/protocol/raw/raw-json-routes.js +25 -2
  284. package/dist/protocol/raw/raw-json-routes.js.map +1 -1
  285. package/dist/protocol/raw/raw-routes.d.ts +245 -3
  286. package/dist/protocol/raw/raw-routes.d.ts.map +1 -1
  287. package/dist/protocol/raw/raw-routes.js +79 -36
  288. package/dist/protocol/raw/raw-routes.js.map +1 -1
  289. package/dist/protocol/route-meta.d.ts.map +1 -1
  290. package/dist/protocol/route-meta.js.map +1 -1
  291. package/dist/schemas/account-routes.d.ts +176 -0
  292. package/dist/schemas/account-routes.d.ts.map +1 -0
  293. package/dist/schemas/account-routes.js +73 -0
  294. package/dist/schemas/account-routes.js.map +1 -0
  295. package/dist/schemas/activity.d.ts.map +1 -1
  296. package/dist/schemas/activity.js.map +1 -1
  297. package/dist/schemas/agent-background.d.ts +48 -0
  298. package/dist/schemas/agent-background.d.ts.map +1 -0
  299. package/dist/schemas/agent-background.js +63 -0
  300. package/dist/schemas/agent-background.js.map +1 -0
  301. package/dist/schemas/agent-land.d.ts +7 -0
  302. package/dist/schemas/agent-land.d.ts.map +1 -1
  303. package/dist/schemas/agent-land.js +11 -0
  304. package/dist/schemas/agent-land.js.map +1 -1
  305. package/dist/schemas/agent.d.ts +4 -0
  306. package/dist/schemas/agent.d.ts.map +1 -1
  307. package/dist/schemas/agent.js +4 -2
  308. package/dist/schemas/agent.js.map +1 -1
  309. package/dist/schemas/agents-list.d.ts +40 -0
  310. package/dist/schemas/agents-list.d.ts.map +1 -1
  311. package/dist/schemas/agents.d.ts +668 -17
  312. package/dist/schemas/agents.d.ts.map +1 -1
  313. package/dist/schemas/agents.js +16 -41
  314. package/dist/schemas/agents.js.map +1 -1
  315. package/dist/schemas/auto-approve.d.ts +12 -0
  316. package/dist/schemas/auto-approve.d.ts.map +1 -0
  317. package/dist/schemas/auto-approve.js +12 -0
  318. package/dist/schemas/auto-approve.js.map +1 -0
  319. package/dist/schemas/automations.d.ts +170 -27
  320. package/dist/schemas/automations.d.ts.map +1 -1
  321. package/dist/schemas/automations.js +26 -34
  322. package/dist/schemas/automations.js.map +1 -1
  323. package/dist/schemas/bridge-heads.d.ts +57 -0
  324. package/dist/schemas/bridge-heads.d.ts.map +1 -0
  325. package/dist/schemas/bridge-heads.js +22 -0
  326. package/dist/schemas/bridge-heads.js.map +1 -0
  327. package/dist/schemas/capabilities.d.ts +21 -0
  328. package/dist/schemas/capabilities.d.ts.map +1 -1
  329. package/dist/schemas/capabilities.js +6 -0
  330. package/dist/schemas/capabilities.js.map +1 -1
  331. package/dist/schemas/checkout-hooks.d.ts +24 -0
  332. package/dist/schemas/checkout-hooks.d.ts.map +1 -0
  333. package/dist/schemas/checkout-hooks.js +23 -0
  334. package/dist/schemas/checkout-hooks.js.map +1 -0
  335. package/dist/schemas/ci-deployments.d.ts +30 -0
  336. package/dist/schemas/ci-deployments.d.ts.map +1 -0
  337. package/dist/schemas/ci-deployments.js +18 -0
  338. package/dist/schemas/ci-deployments.js.map +1 -0
  339. package/dist/schemas/ci-fleet.d.ts +216 -0
  340. package/dist/schemas/ci-fleet.d.ts.map +1 -0
  341. package/dist/schemas/ci-fleet.js +87 -0
  342. package/dist/schemas/ci-fleet.js.map +1 -0
  343. package/dist/schemas/ci.d.ts +348 -21
  344. package/dist/schemas/ci.d.ts.map +1 -1
  345. package/dist/schemas/ci.js +110 -19
  346. package/dist/schemas/ci.js.map +1 -1
  347. package/dist/schemas/command-run.d.ts +29 -0
  348. package/dist/schemas/command-run.d.ts.map +1 -0
  349. package/dist/schemas/command-run.js +20 -0
  350. package/dist/schemas/command-run.js.map +1 -0
  351. package/dist/schemas/connection-hub.d.ts +3 -1
  352. package/dist/schemas/connection-hub.d.ts.map +1 -1
  353. package/dist/schemas/connection-hub.js +2 -1
  354. package/dist/schemas/connection-hub.js.map +1 -1
  355. package/dist/schemas/context-continues.d.ts.map +1 -1
  356. package/dist/schemas/context-continues.js +2 -2
  357. package/dist/schemas/context-continues.js.map +1 -1
  358. package/dist/schemas/data-protection.d.ts +15 -2
  359. package/dist/schemas/data-protection.d.ts.map +1 -1
  360. package/dist/schemas/data-protection.js +15 -23
  361. package/dist/schemas/data-protection.js.map +1 -1
  362. package/dist/schemas/device-stacks.d.ts +131 -0
  363. package/dist/schemas/device-stacks.d.ts.map +1 -1
  364. package/dist/schemas/device-stacks.js +81 -0
  365. package/dist/schemas/device-stacks.js.map +1 -1
  366. package/dist/schemas/devices.d.ts +137 -0
  367. package/dist/schemas/devices.d.ts.map +1 -1
  368. package/dist/schemas/devices.js +11 -2
  369. package/dist/schemas/devices.js.map +1 -1
  370. package/dist/schemas/environment.d.ts +1 -0
  371. package/dist/schemas/environment.d.ts.map +1 -1
  372. package/dist/schemas/environment.js +1 -0
  373. package/dist/schemas/environment.js.map +1 -1
  374. package/dist/schemas/extension-updates.d.ts +1186 -0
  375. package/dist/schemas/extension-updates.d.ts.map +1 -1
  376. package/dist/schemas/extension-updates.js +22 -4
  377. package/dist/schemas/extension-updates.js.map +1 -1
  378. package/dist/schemas/git/git.d.ts +13 -0
  379. package/dist/schemas/git/git.d.ts.map +1 -1
  380. package/dist/schemas/git/git.js +7 -7
  381. package/dist/schemas/git/git.js.map +1 -1
  382. package/dist/schemas/git/index-run.d.ts +1 -0
  383. package/dist/schemas/git/index-run.d.ts.map +1 -1
  384. package/dist/schemas/host-power.d.ts +76 -0
  385. package/dist/schemas/host-power.d.ts.map +1 -0
  386. package/dist/schemas/host-power.js +101 -0
  387. package/dist/schemas/host-power.js.map +1 -0
  388. package/dist/schemas/hosts.d.ts +365 -0
  389. package/dist/schemas/hosts.d.ts.map +1 -1
  390. package/dist/schemas/hosts.js +33 -1
  391. package/dist/schemas/hosts.js.map +1 -1
  392. package/dist/schemas/issues.d.ts +55 -225
  393. package/dist/schemas/issues.d.ts.map +1 -1
  394. package/dist/schemas/issues.js +21 -43
  395. package/dist/schemas/issues.js.map +1 -1
  396. package/dist/schemas/keyring-native.d.ts.map +1 -1
  397. package/dist/schemas/keyring-native.js +3 -1
  398. package/dist/schemas/keyring-native.js.map +1 -1
  399. package/dist/schemas/keyring.d.ts +1 -0
  400. package/dist/schemas/keyring.d.ts.map +1 -1
  401. package/dist/schemas/keyring.js +3 -1
  402. package/dist/schemas/keyring.js.map +1 -1
  403. package/dist/schemas/maintenance.d.ts.map +1 -1
  404. package/dist/schemas/maintenance.js.map +1 -1
  405. package/dist/schemas/members.d.ts.map +1 -1
  406. package/dist/schemas/members.js +2 -14
  407. package/dist/schemas/members.js.map +1 -1
  408. package/dist/schemas/metrics.d.ts +33 -0
  409. package/dist/schemas/metrics.d.ts.map +1 -1
  410. package/dist/schemas/metrics.js +26 -0
  411. package/dist/schemas/metrics.js.map +1 -1
  412. package/dist/schemas/need-kinds.d.ts +19 -0
  413. package/dist/schemas/need-kinds.d.ts.map +1 -0
  414. package/dist/schemas/need-kinds.js +7 -0
  415. package/dist/schemas/need-kinds.js.map +1 -0
  416. package/dist/schemas/needs.d.ts +868 -27
  417. package/dist/schemas/needs.d.ts.map +1 -1
  418. package/dist/schemas/needs.js +79 -9
  419. package/dist/schemas/needs.js.map +1 -1
  420. package/dist/schemas/offload.d.ts +61 -0
  421. package/dist/schemas/offload.d.ts.map +1 -1
  422. package/dist/schemas/offload.js +14 -1
  423. package/dist/schemas/offload.js.map +1 -1
  424. package/dist/schemas/outward-action.d.ts +39 -0
  425. package/dist/schemas/outward-action.d.ts.map +1 -0
  426. package/dist/schemas/outward-action.js +40 -0
  427. package/dist/schemas/outward-action.js.map +1 -0
  428. package/dist/schemas/ports.d.ts +4 -0
  429. package/dist/schemas/ports.d.ts.map +1 -1
  430. package/dist/schemas/ports.js +3 -0
  431. package/dist/schemas/ports.js.map +1 -1
  432. package/dist/schemas/providers/capacity.d.ts +6 -0
  433. package/dist/schemas/providers/capacity.d.ts.map +1 -1
  434. package/dist/schemas/providers/plan-limits.d.ts +1 -0
  435. package/dist/schemas/providers/plan-limits.d.ts.map +1 -1
  436. package/dist/schemas/providers/plan-limits.js +1 -0
  437. package/dist/schemas/providers/plan-limits.js.map +1 -1
  438. package/dist/schemas/providers/refusals.d.ts +12 -0
  439. package/dist/schemas/providers/refusals.d.ts.map +1 -1
  440. package/dist/schemas/providers/refusals.js +4 -0
  441. package/dist/schemas/providers/refusals.js.map +1 -1
  442. package/dist/schemas/remote-access.d.ts +1 -0
  443. package/dist/schemas/remote-access.d.ts.map +1 -1
  444. package/dist/schemas/remote-access.js +1 -0
  445. package/dist/schemas/remote-access.js.map +1 -1
  446. package/dist/schemas/run-targets.d.ts.map +1 -1
  447. package/dist/schemas/run-targets.js +2 -1
  448. package/dist/schemas/run-targets.js.map +1 -1
  449. package/dist/schemas/runner-views.d.ts +24 -0
  450. package/dist/schemas/runner-views.d.ts.map +1 -0
  451. package/dist/schemas/runner-views.js +16 -0
  452. package/dist/schemas/runner-views.js.map +1 -0
  453. package/dist/schemas/sandbox-reach.d.ts +157 -0
  454. package/dist/schemas/sandbox-reach.d.ts.map +1 -0
  455. package/dist/schemas/sandbox-reach.js +112 -0
  456. package/dist/schemas/sandbox-reach.js.map +1 -0
  457. package/dist/schemas/secrets.d.ts +17 -0
  458. package/dist/schemas/secrets.d.ts.map +1 -1
  459. package/dist/schemas/secrets.js +12 -5
  460. package/dist/schemas/secrets.js.map +1 -1
  461. package/dist/schemas/settings-history.d.ts +1 -1
  462. package/dist/schemas/settings-history.d.ts.map +1 -1
  463. package/dist/schemas/settings-history.js +5 -4
  464. package/dist/schemas/settings-history.js.map +1 -1
  465. package/dist/schemas/settings-savings.d.ts +58 -0
  466. package/dist/schemas/settings-savings.d.ts.map +1 -1
  467. package/dist/schemas/settings-savings.js +22 -0
  468. package/dist/schemas/settings-savings.js.map +1 -1
  469. package/dist/schemas/settings.d.ts +20 -42
  470. package/dist/schemas/settings.d.ts.map +1 -1
  471. package/dist/schemas/settings.js +24 -7
  472. package/dist/schemas/settings.js.map +1 -1
  473. package/dist/schemas/stack-grants.d.ts +60 -0
  474. package/dist/schemas/stack-grants.d.ts.map +1 -0
  475. package/dist/schemas/stack-grants.js +33 -0
  476. package/dist/schemas/stack-grants.js.map +1 -0
  477. package/dist/schemas/system.d.ts +19 -0
  478. package/dist/schemas/system.d.ts.map +1 -1
  479. package/dist/schemas/system.js +9 -0
  480. package/dist/schemas/system.js.map +1 -1
  481. package/dist/schemas/terminal.d.ts +46 -0
  482. package/dist/schemas/terminal.d.ts.map +1 -1
  483. package/dist/schemas/terminal.js +19 -0
  484. package/dist/schemas/terminal.js.map +1 -1
  485. package/dist/schemas/watch-sources.d.ts +72 -0
  486. package/dist/schemas/watch-sources.d.ts.map +1 -0
  487. package/dist/schemas/watch-sources.js +88 -0
  488. package/dist/schemas/watch-sources.js.map +1 -0
  489. package/dist/schemas/workspace/workspace-search.d.ts.map +1 -1
  490. package/dist/schemas/workspace/workspace-search.js +1 -1
  491. package/dist/schemas/workspace/workspace-search.js.map +1 -1
  492. package/dist/schemas/wsl-memory.d.ts +76 -0
  493. package/dist/schemas/wsl-memory.d.ts.map +1 -0
  494. package/dist/schemas/wsl-memory.js +36 -0
  495. package/dist/schemas/wsl-memory.js.map +1 -0
  496. package/dist/state/auth-state.d.ts.map +1 -1
  497. package/dist/state/auth-state.js +3 -0
  498. package/dist/state/auth-state.js.map +1 -1
  499. package/dist/state/definition.d.ts +16 -8
  500. package/dist/state/definition.d.ts.map +1 -1
  501. package/dist/state/runtime-state.d.ts +1 -1
  502. package/dist/state/runtime-state.d.ts.map +1 -1
  503. package/dist/state/runtime-state.js +1 -1
  504. package/dist/state/runtime-state.js.map +1 -1
  505. package/dist/state/workspace-state.d.ts +9 -4
  506. package/dist/state/workspace-state.d.ts.map +1 -1
  507. package/dist/state/workspace-state.js +9 -4
  508. package/dist/state/workspace-state.js.map +1 -1
  509. package/dist/sync/workspace-sync-ignores.d.ts +4 -0
  510. package/dist/sync/workspace-sync-ignores.d.ts.map +1 -0
  511. package/dist/sync/workspace-sync-ignores.js +75 -0
  512. package/dist/sync/workspace-sync-ignores.js.map +1 -0
  513. package/dist/text/pages.d.ts.map +1 -1
  514. package/dist/text/pages.js +17 -4
  515. package/dist/text/pages.js.map +1 -1
  516. package/dist/text/transcript-fold.js +2 -2
  517. package/dist/text/transcript-fold.js.map +1 -1
  518. package/package.json +5 -5
  519. package/src/app-routes/app-pages.ts +3 -0
  520. package/src/app-routes/index.ts +1 -0
  521. package/src/app-routes/return-path.ts +16 -0
  522. package/src/briefs/agent-ask.ts +23 -0
  523. package/src/{chores/extension-update.ts → briefs/extension-update-brief.ts} +3 -2
  524. package/src/chores/digest.ts +1 -0
  525. package/src/chores/index.ts +13 -2
  526. package/src/chores/prompt.ts +3 -18
  527. package/src/chores/stack.ts +1 -0
  528. package/src/chores/verdict.ts +1 -0
  529. package/src/chores/workspace-scope.ts +3 -8
  530. package/src/contracts/accounts.contract.ts +3 -0
  531. package/src/contracts/agents.contract.ts +41 -5
  532. package/src/contracts/automations.contract.ts +2 -0
  533. package/src/contracts/capabilities.contract.ts +31 -2
  534. package/src/contracts/ci.contract.ts +119 -37
  535. package/src/contracts/device-ci-runners.contract.ts +81 -0
  536. package/src/contracts/device-stacks.contract.ts +97 -0
  537. package/src/contracts/extensions.contract.ts +12 -1
  538. package/src/contracts/ports.contract.ts +6 -6
  539. package/src/contracts/runner.contract.ts +117 -3
  540. package/src/contracts/runners.contract.ts +19 -0
  541. package/src/contracts/safety.contract.ts +2 -0
  542. package/src/contracts/secrets.contract.ts +39 -0
  543. package/src/contracts/settings.contract.ts +26 -0
  544. package/src/contracts/stack-grants.contract.ts +51 -0
  545. package/src/contracts/system.contract.ts +36 -62
  546. package/src/contracts/workspace.contract.ts +0 -22
  547. package/src/events/agent-events.ts +3 -2
  548. package/src/events/agent-words.test.ts +19 -1
  549. package/src/events/agent-words.ts +36 -2
  550. package/src/events/child-news.test.ts +91 -0
  551. package/src/events/child-news.ts +269 -0
  552. package/src/events/prompt-origins.ts +35 -0
  553. package/src/events/refusal-incidents.ts +60 -19
  554. package/src/events/requests.ts +18 -0
  555. package/src/events/transcript.ts +10 -1
  556. package/src/ids/conversation-ids.test.ts +3 -1
  557. package/src/ids/conversation-ids.ts +6 -4
  558. package/src/ids/project-dir.test.ts +1 -1
  559. package/src/ids/project-dir.ts +1 -1
  560. package/src/ids/project-id.test.ts +14 -0
  561. package/src/ids/project-id.ts +6 -4
  562. package/src/ids/run-row-ids.test.ts +38 -0
  563. package/src/ids/run-row-ids.ts +49 -0
  564. package/src/index.ts +6 -6
  565. package/src/models/agent-catalog.test.ts +7 -4
  566. package/src/models/agent-catalog.ts +3 -2
  567. package/src/models/agent-lanes.ts +8 -1
  568. package/src/models/agent-runtimes.ts +7 -6
  569. package/src/models/agent-standing.ts +13 -0
  570. package/src/models/model-roles.test.ts +61 -4
  571. package/src/models/model-roles.ts +153 -49
  572. package/src/models/model-setups.ts +49 -26
  573. package/src/models/provider-specs.test.ts +2 -2
  574. package/src/models/providers/provider-traits.test.ts +71 -0
  575. package/src/models/providers/provider-traits.ts +144 -0
  576. package/src/netd/browser-wire.ts +13 -0
  577. package/src/netd/generated/browser-wire.json +10 -0
  578. package/src/netd/generated/netd-wire.json +224 -1
  579. package/src/netd/generated/wire.ts +18 -6
  580. package/src/netd/wire-manifests.test.ts +16 -0
  581. package/src/policy/admin/admin-grant.ts +69 -0
  582. package/src/policy/approvals-execution.ts +11 -6
  583. package/src/policy/batch-runs.ts +2 -2
  584. package/src/policy/capabilities/capability-kinds.test.ts +112 -0
  585. package/src/policy/capabilities/capability-kinds.ts +110 -0
  586. package/src/policy/command-classes.ts +5 -3
  587. package/src/policy/credential-material.ts +1 -1
  588. package/src/policy/device-programs.ts +29 -20
  589. package/src/policy/message-limits.ts +8 -4
  590. package/src/policy/org-locks.ts +1 -0
  591. package/src/policy/overlay-lint.ts +1 -1
  592. package/src/policy/reserved-servers.ts +5 -1
  593. package/src/policy/role-capability.ts +3 -1
  594. package/src/policy/shell/command-normalise.test.ts +72 -0
  595. package/src/policy/shell/command-normalise.ts +212 -0
  596. package/src/policy/shell/workspace-root-exclude.ts +11 -0
  597. package/src/policy/tests/admin-grant.test.ts +35 -0
  598. package/src/policy/tests/command-classes.test.ts +41 -0
  599. package/src/protocol/doors/listener-protocol.ts +32 -1
  600. package/src/protocol/doors/loopback-proof.ts +34 -0
  601. package/src/protocol/doors/pass-scopes.ts +12 -0
  602. package/src/protocol/doors/runner-protocol.ts +133 -4
  603. package/src/protocol/doors/sandbox-pass.test.ts +33 -1
  604. package/src/protocol/doors/sandbox-pass.ts +92 -16
  605. package/src/protocol/doors/webext-links.ts +3 -1
  606. package/src/protocol/ingress-contract.fixture.json +5 -1
  607. package/src/protocol/member-reach.test.ts +40 -1
  608. package/src/protocol/member-reach.ts +40 -0
  609. package/src/protocol/peer-mcp-server.ts +6 -0
  610. package/src/protocol/raw/extension-protocol.ts +469 -2
  611. package/src/protocol/raw/raw-json-routes.ts +45 -1
  612. package/src/protocol/raw/raw-routes.ts +133 -40
  613. package/src/protocol/route-meta.ts +4 -1
  614. package/src/schemas/account-routes.ts +126 -0
  615. package/src/schemas/activity.ts +6 -4
  616. package/src/schemas/agent-background.ts +104 -0
  617. package/src/schemas/agent-land.ts +21 -2
  618. package/src/schemas/agent.test.ts +3 -0
  619. package/src/schemas/agent.ts +10 -4
  620. package/src/schemas/agents.ts +26 -65
  621. package/src/schemas/auto-approve.ts +31 -0
  622. package/src/schemas/automations.ts +51 -42
  623. package/src/schemas/bridge-heads.ts +33 -0
  624. package/src/schemas/capabilities.ts +23 -0
  625. package/src/schemas/checkout-hooks.ts +44 -0
  626. package/src/schemas/ci-deployments.ts +26 -0
  627. package/src/schemas/ci-fleet.ts +180 -0
  628. package/src/schemas/ci.ts +185 -45
  629. package/src/schemas/command-run.ts +44 -0
  630. package/src/schemas/compose-overlay.test.ts +1 -1
  631. package/src/schemas/compose-overlay.ts +1 -1
  632. package/src/schemas/connection-hub.ts +4 -2
  633. package/src/schemas/context-continues.ts +6 -3
  634. package/src/schemas/data-protection.ts +28 -34
  635. package/src/schemas/device-stacks.ts +162 -3
  636. package/src/schemas/device-swaps.test.ts +1 -1
  637. package/src/schemas/devices.ts +31 -2
  638. package/src/schemas/egress-private.test.ts +1 -1
  639. package/src/schemas/environment.ts +4 -0
  640. package/src/schemas/extension-updates.ts +35 -7
  641. package/src/schemas/git/git.ts +14 -14
  642. package/src/schemas/host-power.test.ts +53 -0
  643. package/src/schemas/host-power.ts +173 -0
  644. package/src/schemas/hosts.test.ts +32 -0
  645. package/src/schemas/hosts.ts +86 -2
  646. package/src/schemas/intentic-os.ts +2 -2
  647. package/src/schemas/issues.ts +43 -86
  648. package/src/schemas/keyring-native.test.ts +11 -3
  649. package/src/schemas/keyring-native.ts +3 -1
  650. package/src/schemas/keyring.ts +6 -1
  651. package/src/schemas/maintenance.ts +4 -3
  652. package/src/schemas/members.ts +4 -16
  653. package/src/schemas/metrics.test.ts +9 -1
  654. package/src/schemas/metrics.ts +43 -0
  655. package/src/schemas/need-kinds.ts +13 -0
  656. package/src/schemas/needs.ts +118 -14
  657. package/src/schemas/offload.ts +37 -3
  658. package/src/schemas/outward-action.ts +47 -0
  659. package/src/schemas/ports.ts +5 -0
  660. package/src/schemas/providers/plan-limits.ts +1 -0
  661. package/src/schemas/providers/refusals.ts +9 -0
  662. package/src/schemas/remote-access.ts +3 -0
  663. package/src/schemas/run-targets.ts +2 -1
  664. package/src/schemas/runner-views.ts +27 -0
  665. package/src/schemas/sandbox-reach.ts +161 -0
  666. package/src/schemas/secrets.ts +23 -5
  667. package/src/schemas/settings-history.ts +10 -5
  668. package/src/schemas/settings-savings.ts +29 -0
  669. package/src/schemas/settings.test.ts +24 -23
  670. package/src/schemas/settings.ts +55 -22
  671. package/src/schemas/stack-grants.ts +59 -0
  672. package/src/schemas/state-plan.test.ts +1 -1
  673. package/src/schemas/state-plan.ts +2 -2
  674. package/src/schemas/system.ts +16 -1
  675. package/src/schemas/terminal.ts +28 -0
  676. package/src/schemas/updates.test.ts +1 -1
  677. package/src/schemas/updates.ts +1 -1
  678. package/src/schemas/version-seam.test.ts +4 -1
  679. package/src/schemas/watch-sources.ts +127 -0
  680. package/src/schemas/workspace/workspace-search.ts +5 -2
  681. package/src/schemas/wsl-memory.ts +59 -0
  682. package/src/state/auth-state.ts +10 -0
  683. package/src/state/runtime-state.test.ts +3 -2
  684. package/src/state/runtime-state.ts +3 -1
  685. package/src/state/update-probation.ts +1 -1
  686. package/src/state/ways-back.test.ts +1 -1
  687. package/src/state/workspace-state.test.ts +2 -0
  688. package/src/state/workspace-state.ts +21 -21
  689. package/src/sync/workspace-sync-ignores.test.ts +48 -0
  690. package/src/sync/workspace-sync-ignores.ts +143 -0
  691. package/src/text/embed.ts +2 -2
  692. package/src/text/pages.ts +34 -7
  693. package/src/text/transcript-fold.test.ts +40 -2
  694. package/src/text/transcript-fold.ts +2 -2
  695. package/dist/chores/extension-update.d.ts.map +0 -1
  696. package/dist/chores/extension-update.js.map +0 -1
  697. package/dist/contracts/chores.contract.d.ts +0 -213
  698. package/dist/contracts/chores.contract.d.ts.map +0 -1
  699. package/dist/contracts/chores.contract.js +0 -32
  700. package/dist/contracts/chores.contract.js.map +0 -1
  701. package/dist/contracts/issues.contract.d.ts +0 -95
  702. package/dist/contracts/issues.contract.d.ts.map +0 -1
  703. package/dist/contracts/issues.contract.js +0 -50
  704. package/dist/contracts/issues.contract.js.map +0 -1
  705. package/src/chores/chores.test.ts +0 -24
  706. package/src/chores/digest.test.ts +0 -27
  707. package/src/chores/probes.integration.test.ts +0 -494
  708. package/src/chores/stack.test.ts +0 -140
  709. package/src/chores/verdict.test.ts +0 -761
  710. package/src/contracts/chores.contract.ts +0 -39
  711. package/src/contracts/issues.contract.ts +0 -53
@@ -1,494 +0,0 @@
1
- import { execFileSync } from "node:child_process";
2
- import { chmodSync, existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
3
- import { tmpdir } from "node:os";
4
- import { dirname, join } from "node:path";
5
- import { choreById } from "./chores.js";
6
- import { AUDIT_COMMAND, probeSpec } from "./probes.js";
7
- import { IDIOM_RULES } from "./stack.js";
8
- import { WORKSPACE_ROOT_JSCPD_EXCLUDE_ARG, WORKSPACE_ROOT_RG_EXCLUDE_ARG } from "./workspace-scope.js";
9
-
10
- // Parsers face real tool output: warning lines before JSON, moved fields, empty runs. Unrecognized output must return
11
- // undefined, never throw, never read as clean.
12
-
13
- const parse = (id: Parameters<typeof probeSpec>[0], stdout: string) => probeSpec(id).parse(stdout);
14
-
15
- describe(`outdated`, () => {
16
- test(`reads pnpm's name → {current, latest} map and classifies the semver step`, () => {
17
- const facts = parse(
18
- `outdated`,
19
- JSON.stringify({
20
- vue: { current: `3.4.1`, latest: `4.0.0`, dependencyType: `dependencies` },
21
- vitest: { current: `2.1.0`, latest: `2.3.4`, dependencyType: `devDependencies` },
22
- zod: { current: `4.4.3`, latest: `4.4.9`, dependencyType: `dependencies` },
23
- }),
24
- );
25
- expect(facts).toEqual({
26
- id: `outdated`,
27
- packages: [
28
- { name: `vue`, current: `3.4.1`, latest: `4.0.0`, kind: `major`, section: `dependencies` },
29
- { name: `vitest`, current: `2.1.0`, latest: `2.3.4`, kind: `minor`, section: `devDependencies` },
30
- { name: `zod`, current: `4.4.3`, latest: `4.4.9`, kind: `patch`, section: `dependencies` },
31
- ],
32
- });
33
- });
34
-
35
- test(`skips entries pnpm could not resolve, rather than inventing a version for them`, () => {
36
- const facts = parse(
37
- `outdated`,
38
- JSON.stringify({ ok: { current: `1.0.0`, latest: `2.0.0` }, broken: { current: `1.0.0` }, alsoBroken: null }),
39
- );
40
- expect(facts).toEqual({
41
- id: `outdated`,
42
- packages: [{ name: `ok`, current: `1.0.0`, latest: `2.0.0`, kind: `major`, section: `dependencies` }],
43
- });
44
- });
45
-
46
- test(`finds the JSON after a leading warning line`, () => {
47
- expect(parse(`outdated`, ` WARN Ignoring broken lockfile\n{"vue":{"current":"1.0.0","latest":"2.0.0"}}`)).toEqual({
48
- id: `outdated`,
49
- packages: [{ name: `vue`, current: `1.0.0`, latest: `2.0.0`, kind: `major`, section: `dependencies` }],
50
- });
51
- });
52
-
53
- test(`an empty report is no packages, not a failure`, () => {
54
- expect(parse(`outdated`, `{}`)).toEqual({ id: `outdated`, packages: [] });
55
- });
56
-
57
- test(`output that is not JSON at all is a failure, never a clean result`, () => {
58
- expect(parse(`outdated`, `ERR_PNPM_NO_LOCKFILE Cannot proceed`)).toBeUndefined();
59
- });
60
-
61
- // pnpm 12's recursive report, verbatim in shape: a package seen as both a dependency and a devDependency is keyed
62
- // `name@version` and `name@version (dev)`, which once surfaced as two rows under names no registry knows.
63
- test(`reads pnpm 12's disambiguated keys as the package they name, one row per upgrade`, () => {
64
- const facts = parse(
65
- `outdated`,
66
- JSON.stringify({
67
- "mermaid@12.0.0 (dev)": { current: `12.0.0`, latest: `12.1.0`, dependencyType: `devDependencies` },
68
- "mermaid@12.0.0": { current: `12.0.0`, latest: `12.1.0`, dependencyType: `dependencies` },
69
- "@scope/tool@1.0.0 (dev)": { current: `1.0.0`, latest: `2.0.0`, dependencyType: `devDependencies` },
70
- "@scope/tool@1.1.0": { current: `1.1.0`, latest: `2.0.0`, dependencyType: `dependencies` },
71
- }),
72
- );
73
- expect(facts).toEqual({
74
- id: `outdated`,
75
- packages: [
76
- // The shipped copy wins the section, whichever order pnpm listed them in.
77
- { name: `mermaid`, current: `12.0.0`, latest: `12.1.0`, kind: `minor`, section: `dependencies` },
78
- // Two versions in the tree are two upgrades, so they stay two rows.
79
- { name: `@scope/tool`, current: `1.0.0`, latest: `2.0.0`, kind: `major`, section: `devDependencies` },
80
- { name: `@scope/tool`, current: `1.1.0`, latest: `2.0.0`, kind: `major`, section: `dependencies` },
81
- ],
82
- });
83
- });
84
-
85
- test(`a package the workspace leaves out is measured too, and says which folder it is`, () => {
86
- const stdout = [
87
- JSON.stringify({ vue: { current: `3.4.1`, latest: `3.4.2`, dependencyType: `dependencies` } }, null, 2),
88
- `{"standalone":"_editor/ios-app"}`,
89
- JSON.stringify({ "@capacitor/ios": { current: `8.5.0`, latest: `8.5.2`, dependencyType: `dependencies` } }, null, 2),
90
- ].join(`\n`);
91
- expect(parse(`outdated`, stdout)).toEqual({
92
- id: `outdated`,
93
- packages: [
94
- { name: `vue`, current: `3.4.1`, latest: `3.4.2`, kind: `patch`, section: `dependencies` },
95
- { name: `@capacitor/ios`, current: `8.5.0`, latest: `8.5.2`, kind: `patch`, section: `dependencies`, standalone: `_editor/ios-app` },
96
- ],
97
- });
98
- });
99
-
100
- test(`a standalone package that printed nothing fails the probe rather than reading as up to date`, () => {
101
- expect(parse(`outdated`, `{}\n{"standalone":"_editor/ios-app"}\n`)).toBeUndefined();
102
- });
103
- });
104
-
105
- describe(`audit`, () => {
106
- const advisory = (over: Record<string, unknown>) => ({
107
- module_name: `left-pad`,
108
- severity: `high`,
109
- title: `Prototype pollution`,
110
- patched_versions: `>=1.3.0`,
111
- findings: [{ dev: false }],
112
- ...over,
113
- });
114
-
115
- test(`carries which package, how bad, and whether a fix exists`, () => {
116
- expect(parse(`audit`, JSON.stringify({ advisories: { "1": advisory({}) } }))).toEqual({
117
- id: `audit`,
118
- advisories: [{ name: `left-pad`, severity: `high`, title: `Prototype pollution`, patched: `>=1.3.0`, dev: false }],
119
- });
120
- });
121
-
122
- test(`treats "<0.0.0" as no patch published`, () => {
123
- const facts = parse(`audit`, JSON.stringify({ advisories: { "1": advisory({ patched_versions: `<0.0.0` }) } }));
124
- expect(facts).toEqual({ id: `audit`, advisories: [expect.not.objectContaining({ patched: expect.anything() })] });
125
- });
126
-
127
- test(`an advisory is dev-only only when every finding is`, () => {
128
- const mixed = parse(`audit`, JSON.stringify({ advisories: { "1": advisory({ findings: [{ dev: true }, { dev: false }] }) } }));
129
- const devOnly = parse(`audit`, JSON.stringify({ advisories: { "1": advisory({ findings: [{ dev: true }, { dev: true }] }) } }));
130
- expect(mixed).toMatchObject({ advisories: [{ dev: false }] });
131
- expect(devOnly).toMatchObject({ advisories: [{ dev: true }] });
132
- });
133
-
134
- test(`a report with no advisories key is clean, not unparseable`, () => {
135
- expect(parse(`audit`, JSON.stringify({ metadata: { vulnerabilities: { high: 0 } } }))).toEqual({ id: `audit`, advisories: [] });
136
- });
137
- });
138
-
139
- // The audit command run for real, against a fake `pnpm` on PATH: what is under test is the shell (which folders count
140
- // as standalone, the scratch copy, the markers), not pnpm, and not the network.
141
- describe(`the audit command across packages the workspace leaves out`, () => {
142
- const roots: string[] = [];
143
- afterEach(() => {
144
- for (const root of roots.splice(0)) {
145
- rmSync(root, { recursive: true, force: true });
146
- }
147
- });
148
-
149
- // Reports one advisory named after the package it was run in, so the test can see where each run happened.
150
- // `FAIL_INSTALL` stands in for a registry that cannot be reached.
151
- const FAKE_PNPM = `#!/bin/sh
152
- name=$(sed -n 's/.*"name": *"\\([^"]*\\)".*/\\1/p' package.json)
153
- case "$*" in
154
- *"install --lockfile-only"*) [ -z "$FAIL_INSTALL" ] || exit 1; echo "lockfileVersion: '9.0'" > pnpm-lock.yaml ;;
155
- *audit*) printf '{"advisories":{"1":{"module_name":"%s","severity":"critical","title":"ran in %s","findings":[{"dev":false}]}}}\\n' "$name" "$PWD"; exit 1 ;;
156
- esac
157
- `;
158
-
159
- const repo = (files: Record<string, string>): string => {
160
- const root = mkdtempSync(join(tmpdir(), `probe-standalone-`));
161
- roots.push(root);
162
- for (const [path, text] of Object.entries({ ...files, "bin/pnpm": FAKE_PNPM })) {
163
- mkdirSync(dirname(join(root, path)), { recursive: true });
164
- writeFileSync(join(root, path), text);
165
- }
166
- chmodSync(join(root, `bin/pnpm`), 0o755);
167
- return root;
168
- };
169
-
170
- const audit = (root: string, env: Record<string, string> = {}) =>
171
- probeSpec(`audit`).parse(
172
- execFileSync(`sh`, [`-c`, AUDIT_COMMAND], {
173
- cwd: root,
174
- encoding: `utf8`,
175
- env: { ...process.env, ...env, PATH: `${join(root, `bin`)}:${process.env[`PATH`] ?? ``}` },
176
- }),
177
- );
178
-
179
- const WORKSPACE = [
180
- `packages:`,
181
- ` - "app"`,
182
- ` # The shell is installed on its own.`,
183
- ` - "!shell"`,
184
- ` - '!native/**'`,
185
- ` - "!**/fixtures/**"`,
186
- ` - "!gone"`,
187
- `publicHoistPattern:`,
188
- ` - "!app"`,
189
- ``,
190
- ].join(`\n`);
191
-
192
- test(`audits each literal exclusion with a manifest, in a scratch copy, and names the folder`, () => {
193
- const root = repo({
194
- "pnpm-workspace.yaml": WORKSPACE,
195
- "package.json": `{"name": "root"}`,
196
- "app/package.json": `{"name": "app"}`,
197
- "shell/package.json": `{"name": "shell"}`,
198
- "native/package.json": `{"name": "native"}`,
199
- "fixtures/x/package.json": `{"name": "fixture"}`,
200
- });
201
- const facts = audit(root);
202
- const advisories = facts?.id === `audit` ? facts.advisories : [];
203
- // The workspace's own report carries no folder; a fixture, a hoist pattern and a folder that is gone are not packages.
204
- expect(advisories.map((advisory) => [advisory.name, advisory.standalone])).toEqual([
205
- [`root`, undefined],
206
- [`shell`, `shell`],
207
- [`native`, `native`],
208
- ]);
209
- // Measured in a copy: nothing was written into the folder pnpm deliberately does not manage.
210
- expect(existsSync(join(root, `shell/pnpm-lock.yaml`))).toBe(false);
211
- expect(JSON.stringify(facts)).not.toContain(`ran in ${join(root, `shell`)}`);
212
- });
213
-
214
- test(`a standalone package that cannot be resolved fails the probe, never reads as clean`, () => {
215
- const root = repo({ "pnpm-workspace.yaml": WORKSPACE, "package.json": `{"name": "root"}`, "shell/package.json": `{"name": "shell"}` });
216
- expect(audit(root, { FAIL_INSTALL: `1` })).toBeUndefined();
217
- });
218
-
219
- test(`a repo with no workspace file is audited as it always was`, () => {
220
- const root = repo({ "package.json": `{"name": "root"}` });
221
- expect(audit(root)).toMatchObject({ advisories: [{ name: `root` }] });
222
- });
223
- });
224
-
225
- describe(`knip`, () => {
226
- test(`sums the per-file issue arrays and samples the wholly unreferenced files`, () => {
227
- const facts = parse(
228
- `knip`,
229
- JSON.stringify({
230
- issues: [
231
- {
232
- file: `src/a.ts`,
233
- exports: [{ name: `x` }, { name: `y` }],
234
- types: [{ name: `T` }],
235
- dependencies: [{ name: `lodash` }],
236
- devDependencies: [],
237
- files: [],
238
- },
239
- { file: `src/b.ts`, exports: [{ name: `z` }], types: [], dependencies: [], devDependencies: [{ name: `jest` }], files: [] },
240
- { file: `src/old.ts`, exports: [], files: [{ name: `src/old.ts` }] },
241
- { file: `src/older.ts`, exports: [], files: [{ name: `src/older.ts` }] },
242
- ],
243
- }),
244
- );
245
- expect(facts).toEqual({
246
- id: `knip`,
247
- deadCode: { files: 2, exports: 3, types: 1, dependencies: 1, devDependencies: 1, sample: [`src/old.ts`, `src/older.ts`] },
248
- });
249
- });
250
-
251
- test(`missing per-kind arrays count as zero rather than throwing`, () => {
252
- expect(parse(`knip`, JSON.stringify({ issues: [{ file: `src/a.ts` }, null] }))).toMatchObject({
253
- deadCode: { files: 0, exports: 0, types: 0, dependencies: 0, devDependencies: 0, sample: [] },
254
- });
255
- });
256
-
257
- test(`an empty issue list is a clean repository, not an unrecognisable one`, () => {
258
- expect(parse(`knip`, JSON.stringify({ issues: [] }))).toEqual({
259
- id: `knip`,
260
- deadCode: { files: 0, exports: 0, types: 0, dependencies: 0, devDependencies: 0, sample: [] },
261
- });
262
- });
263
-
264
- test(`a shape without an issues array is a failure`, () => {
265
- expect(parse(`knip`, JSON.stringify({ files: [`src/old.ts`] }))).toBeUndefined();
266
- });
267
- });
268
-
269
- describe(`jscpd`, () => {
270
- test(`the root-scoped command carries the reference-shelf prune argument`, () => {
271
- expect(probeSpec(`jscpd`).command).toContain(WORKSPACE_ROOT_JSCPD_EXCLUDE_ARG);
272
- expect(choreById(`duplication`)?.automation?.guard).toContain(WORKSPACE_ROOT_JSCPD_EXCLUDE_ARG);
273
- });
274
-
275
- test(`takes the percentage of scanned lines and the biggest clones, longest first`, () => {
276
- const facts = parse(
277
- `jscpd`,
278
- JSON.stringify({
279
- statistics: { total: { percentage: 7.4, lines: 1000 } },
280
- duplicates: [
281
- { lines: 12, firstFile: { name: `a.ts` }, secondFile: { name: `b.ts` } },
282
- { lines: 40, firstFile: { name: `c.ts` }, secondFile: { name: `d.ts` } },
283
- ],
284
- }),
285
- );
286
- expect(facts).toEqual({
287
- id: `jscpd`,
288
- duplication: {
289
- percentage: 7.4,
290
- clones: 2,
291
- top: [
292
- { lines: 40, first: `c.ts`, second: `d.ts` },
293
- { lines: 12, first: `a.ts`, second: `b.ts` },
294
- ],
295
- },
296
- });
297
- });
298
-
299
- test(`a clean run reports zero percent with no clones`, () => {
300
- expect(parse(`jscpd`, JSON.stringify({ statistics: { total: { percentage: 0 } }, duplicates: [] }))).toMatchObject({
301
- duplication: { percentage: 0, clones: 0, top: [] },
302
- });
303
- });
304
-
305
- test(`no output at all is a failure`, () => {
306
- expect(parse(`jscpd`, ``)).toBeUndefined();
307
- });
308
- });
309
-
310
- // Two of the eight mutation statuses count counter-intuitively; tested by name since getting either backwards looks
311
- // plausible.
312
- describe(`mutation`, () => {
313
- const report = (...mutants: readonly Record<string, unknown>[]) =>
314
- JSON.stringify({
315
- schemaVersion: `2.0`,
316
- files: { "src/digest.ts": { language: `typescript`, source: `…`, mutants } },
317
- });
318
- const mutant = (status: string, line = 1) => ({
319
- id: `${status}-${line}`,
320
- mutatorName: `ConditionalExpression`,
321
- replacement: `false`,
322
- location: { start: { line, column: 1 }, end: { line, column: 9 } },
323
- status,
324
- });
325
-
326
- test(`counts Killed and Timeout as caught, Survived and NoCoverage as missed`, () => {
327
- const facts = parse(`mutation`, report(mutant(`Killed`), mutant(`Timeout`), mutant(`Survived`), mutant(`NoCoverage`)));
328
- expect(facts).toMatchObject({ id: `mutation`, mutation: { killed: 2, survived: 2, score: 50 } });
329
- });
330
-
331
- test(`leaves mutants that never got a verdict out of the score entirely`, () => {
332
- const facts = parse(
333
- `mutation`,
334
- report(mutant(`Killed`), mutant(`Survived`), mutant(`CompileError`), mutant(`RuntimeError`), mutant(`Ignored`)),
335
- );
336
- expect(facts).toMatchObject({ id: `mutation`, mutation: { killed: 1, survived: 1, inconclusive: 3, score: 50 } });
337
- });
338
-
339
- test(`names each survivor with the change that went unnoticed`, () => {
340
- const facts = parse(`mutation`, report(mutant(`Survived`, 43)));
341
- expect(facts).toMatchObject({
342
- mutation: { survivors: [{ file: `src/digest.ts`, line: 43, mutator: `ConditionalExpression`, replacement: `false` }] },
343
- });
344
- });
345
-
346
- test(`renders a deleted expression as a removal rather than as nothing`, () => {
347
- const facts = parse(`mutation`, report({ ...mutant(`Survived`), replacement: `` }));
348
- expect(facts).toMatchObject({ mutation: { survivors: [{ replacement: `(removed)` }] } });
349
- });
350
-
351
- test(`a run with nothing to mutate is 100%, not a division by zero`, () => {
352
- expect(parse(`mutation`, JSON.stringify({ schemaVersion: `2.0`, files: {} }))).toMatchObject({
353
- mutation: { score: 100, killed: 0, survived: 0 },
354
- });
355
- });
356
-
357
- test(`output without a files map is a failure, not a clean repository`, () => {
358
- expect(parse(`mutation`, JSON.stringify({ schemaVersion: `2.0` }))).toBeUndefined();
359
- expect(parse(`mutation`, ``)).toBeUndefined();
360
- expect(parse(`mutation`, JSON.stringify({ files: [] }))).toBeUndefined();
361
- });
362
-
363
- test(`survives a malformed mutant without losing the rest of the file's numbers`, () => {
364
- const facts = parse(`mutation`, report(mutant(`Killed`), { nonsense: true }, mutant(`Survived`)));
365
- expect(facts).toMatchObject({ mutation: { killed: 1, survived: 1, inconclusive: 1 } });
366
- });
367
- });
368
-
369
- // The sweep is our own command, not third-party JSON; the risk is a silently empty pipeline stage, which the marker
370
- // line exists to catch.
371
- describe(`ui`, () => {
372
- const sweep = (...lines: readonly string[]) => [`UI`, ...lines].join(`\n`);
373
-
374
- test(`sorts the labelled lines into an inventory, per-file counts and idioms`, () => {
375
- const facts = parse(
376
- `ui`,
377
- sweep(
378
- `COMPONENT\tsrc/Button.vue`,
379
- `COMPONENT\tsrc/Card.tsx`,
380
- `BYPASS\tsrc/Button.vue:3`,
381
- `IDIOM\tvue-options-api\tsrc/Button.vue`,
382
- `IDIOM\tvue-2-lifecycle\tsrc/Button.vue`,
383
- `IDIOM\tvue-options-api\tsrc/Old.vue`,
384
- ),
385
- );
386
- expect(facts).toEqual({
387
- id: `ui`,
388
- scan: {
389
- components: [`src/Button.vue`, `src/Card.tsx`],
390
- bypasses: [{ path: `src/Button.vue`, count: 3 }],
391
- idioms: [
392
- { id: `vue-options-api`, files: [`src/Button.vue`, `src/Old.vue`] },
393
- { id: `vue-2-lifecycle`, files: [`src/Button.vue`] },
394
- ],
395
- },
396
- });
397
- });
398
-
399
- test(`the marker alone is a clean repository`, () => {
400
- expect(parse(`ui`, sweep())).toEqual({ id: `ui`, scan: { components: [], bypasses: [], idioms: [] } });
401
- });
402
-
403
- test(`output with no marker is a failure, however much of it there is`, () => {
404
- expect(parse(`ui`, ``)).toBeUndefined();
405
- expect(parse(`ui`, `COMPONENT\tsrc/Button.vue`)).toBeUndefined();
406
- expect(parse(`ui`, `rg: unrecognized flag --count-matches`)).toBeUndefined();
407
- });
408
-
409
- test(`splits a count off the end of a path that contains a colon`, () => {
410
- expect(parse(`ui`, sweep(`BYPASS\tsrc/weird:name.vue:7`))).toMatchObject({ scan: { bypasses: [{ path: `src/weird:name.vue`, count: 7 }] } });
411
- });
412
-
413
- test(`a line that is not a count is dropped rather than counted as zero`, () => {
414
- expect(parse(`ui`, sweep(`BYPASS\tsrc/Button.vue`, `BYPASS\tsrc/Card.tsx:notanumber`))).toMatchObject({ scan: { bypasses: [] } });
415
- });
416
-
417
- test(`strips the prefix ripgrep prints for a path it was told to walk`, () => {
418
- expect(parse(`ui`, sweep(`COMPONENT\t./src/Button.vue`, `BYPASS\t./src/Button.vue:3`, `IDIOM\tvue-options-api\t./src/Old.vue`))).toEqual({
419
- id: `ui`,
420
- scan: {
421
- components: [`src/Button.vue`],
422
- bypasses: [{ path: `src/Button.vue`, count: 3 }],
423
- idioms: [{ id: `vue-options-api`, files: [`src/Old.vue`] }],
424
- },
425
- });
426
- });
427
-
428
- test(`an idiom line naming no file is dropped rather than recorded as an empty path`, () => {
429
- expect(parse(`ui`, sweep(`IDIOM\tvue-options-api`, `IDIOM\tvue-options-api\t`))).toMatchObject({ scan: { idioms: [] } });
430
- });
431
- });
432
-
433
- // Tests the composed command directly: past bugs here produced no visible difference in output, only a broken command.
434
- describe(`the sweep's composed command`, () => {
435
- const stages = (): string[] => probeSpec(`ui`).command.split(`; `);
436
-
437
- test(`both ripgrep entry points carry the root-scoped prune argument`, () => {
438
- expect(probeSpec(`ui`).available).toContain(WORKSPACE_ROOT_RG_EXCLUDE_ARG);
439
- expect(probeSpec(`ui`).command.split(WORKSPACE_ROOT_RG_EXCLUDE_ARG)).toHaveLength(3 + IDIOM_RULES.length);
440
- });
441
-
442
- test(`every ripgrep is given a path to walk, including the availability gate`, () => {
443
- const searches = stages().filter((stage) => stage.startsWith(`rg `));
444
- expect(searches).toHaveLength(IDIOM_RULES.length + 2);
445
- for (const search of searches) {
446
- expect(search.split(`2>/dev/null`)[0], search).toMatch(/ \.\s*$/);
447
- }
448
- expect(probeSpec(`ui`).available).toMatch(/ \. >\/dev\/null$/);
449
- });
450
-
451
- test(`an absent rule asks which files do NOT match, and no rule reaches for PCRE2`, () => {
452
- for (const rule of IDIOM_RULES) {
453
- const stage = stages().find((part) => part.includes(`"IDIOM\\t${rule.id}\\t"`));
454
- expect(stage, rule.id).toContain(rule.absent === undefined ? `rg --no-messages -l ` : `rg --no-messages --files-without-match `);
455
- }
456
- expect(probeSpec(`ui`).command).not.toContain(`-P `);
457
- });
458
- });
459
-
460
- describe(`bundle`, () => {
461
- test(`reads the directory and each asset's raw and gzipped size`, () => {
462
- const facts = parse(
463
- `bundle`,
464
- [`DIR\tdist`, `ASSET\t54038\t41096\tdist/assets/vendor-abc.js`, `ASSET\t2704\t2103\tdist/assets/style.css`].join(`\n`),
465
- );
466
- expect(facts).toEqual({
467
- id: `bundle`,
468
- bundle: {
469
- dir: `dist`,
470
- totalBytes: 56742,
471
- totalGzip: 43199,
472
- assets: [
473
- { path: `dist/assets/vendor-abc.js`, bytes: 54038, gzip: 41096 },
474
- { path: `dist/assets/style.css`, bytes: 2704, gzip: 2103 },
475
- ],
476
- },
477
- });
478
- });
479
-
480
- test(`a directory line with no assets is an empty build, not a failure`, () => {
481
- expect(parse(`bundle`, `DIR\tbuild`)).toMatchObject({ bundle: { dir: `build`, assets: [], totalBytes: 0, totalGzip: 0 } });
482
- });
483
-
484
- test(`no directory line is a failure`, () => {
485
- expect(parse(`bundle`, ``)).toBeUndefined();
486
- expect(parse(`bundle`, `find: dist: No such file or directory`)).toBeUndefined();
487
- });
488
-
489
- test(`an asset whose sizes did not come through is skipped, never counted as zero bytes`, () => {
490
- expect(parse(`bundle`, [`DIR\tdist`, `ASSET\t\t\tdist/broken.js`, `ASSET\t10\t5\tdist/ok.js`].join(`\n`))).toMatchObject({
491
- bundle: { assets: [{ path: `dist/ok.js`, bytes: 10, gzip: 5 }] },
492
- });
493
- });
494
- });
@@ -1,140 +0,0 @@
1
- import { componentStem, frameworksOf, IDIOM_RULES, idiomRule, UI_FRAMEWORKS, usesTailwind } from "./stack.js";
2
-
3
- // Guards shell-safety of interpolated patterns (checked unattended on a remote machine) and the stem normalizer below
4
- // the table.
5
-
6
- describe(`the patterns are safe to interpolate`, () => {
7
- test(`no pattern or glob contains an apostrophe`, () => {
8
- for (const rule of IDIOM_RULES) {
9
- expect(rule.pattern, rule.id).not.toContain(`'`);
10
- for (const glob of rule.globs) {
11
- expect(glob, rule.id).not.toContain(`'`);
12
- }
13
- }
14
- });
15
-
16
- test(`every pattern parses as a regex`, () => {
17
- for (const rule of IDIOM_RULES) {
18
- expect(() => new RegExp(rule.pattern), rule.id).not.toThrow();
19
- }
20
- });
21
-
22
- test(`no pattern uses a lookaround`, () => {
23
- for (const rule of IDIOM_RULES) {
24
- expect(rule.pattern, rule.id).not.toMatch(/\(\?<?[=!]/);
25
- }
26
- });
27
-
28
- test(`an absent rule is scoped to a component file type, never to a whole language`, () => {
29
- for (const rule of IDIOM_RULES.filter((candidate) => candidate.absent !== undefined)) {
30
- for (const glob of rule.globs) {
31
- expect([`*.ts`, `*.js`, `*.mts`, `*.cts`, `*.mjs`, `*.cjs`], rule.id).not.toContain(glob);
32
- }
33
- }
34
- });
35
-
36
- test(`every rule has a unique id and belongs to a framework in the table`, () => {
37
- const ids = new Set(IDIOM_RULES.map((rule) => rule.id));
38
- expect(ids.size).toBe(IDIOM_RULES.length);
39
- for (const rule of IDIOM_RULES) {
40
- expect(
41
- UI_FRAMEWORKS.map((framework) => framework.id),
42
- rule.id,
43
- ).toContain(rule.framework);
44
- }
45
- });
46
-
47
- test(`every rule names what replaced it`, () => {
48
- for (const rule of IDIOM_RULES) {
49
- expect(rule.replacement.length, rule.id).toBeGreaterThan(3);
50
- }
51
- });
52
-
53
- test(`idiomRule finds a rule the scan reports, and admits when it cannot`, () => {
54
- expect(idiomRule(`vue-options-api`)?.framework).toBe(`vue`);
55
- expect(idiomRule(`from-a-newer-daemon`)).toBeUndefined();
56
- });
57
- });
58
-
59
- // Only rule names built from ordinary words are tested against real lines; `@NgModule(` and `ReactDOM.render(` can't be
60
- // mistaken for anything else.
61
- describe(`the Vue 2 teardown hooks`, () => {
62
- const hits = (line: string): boolean => new RegExp(idiomRule(`vue-2-lifecycle`)?.pattern ?? `(?:)`).test(line);
63
-
64
- test(`a hook is found however the component writes it`, () => {
65
- expect(hits(` destroyed() {`)).toBe(true);
66
- expect(hits(` beforeDestroy() {`)).toBe(true);
67
- expect(hits(` destroyed: function () {`)).toBe(true);
68
- expect(hits(` destroyed: async () => {`)).toBe(true);
69
- expect(hits(` beforeDestroy: this.teardown,`)).toBe(true);
70
- });
71
-
72
- test(`a field named after the word is not a hook`, () => {
73
- expect(hits(`): Promise<{ warned: number; destroyed: number; dropped: number }> => {`)).toBe(false);
74
- expect(hits(` const tally = { warned: 0, destroyed: 0, dropped: 0 };`)).toBe(false);
75
- expect(hits(` return \`destroyed\`;`)).toBe(false);
76
- expect(hits(` if (machine.destroyed) {`)).toBe(false);
77
- expect(hits(`type IdleVerdict = "kept" | "warned" | "destroyed" | "dropped";`)).toBe(false);
78
- });
79
-
80
- test(`the sweep asks the question of components only`, () => {
81
- expect(idiomRule(`vue-2-lifecycle`)?.globs).toEqual([`*.vue`]);
82
- });
83
- });
84
-
85
- describe(`recognising the stack`, () => {
86
- test(`a framework is recognised from any manifest's dependency names`, () => {
87
- expect(frameworksOf([`vue`, `vite`]).map((framework) => framework.id)).toEqual([`vue`]);
88
- expect(frameworksOf([`react`, `@angular/core`]).map((framework) => framework.id)).toEqual([`react`, `angular`]);
89
- expect(frameworksOf([`pino`, `zod`])).toEqual([]);
90
- });
91
-
92
- test(`a package merely named after a framework is not that framework`, () => {
93
- expect(frameworksOf([`@vueuse/core`, `react-hook-form`, `eslint-plugin-vue`])).toEqual([]);
94
- });
95
-
96
- test(`Tailwind is recognised on its own, without a framework`, () => {
97
- expect(usesTailwind([`tailwindcss`])).toBe(true);
98
- expect(usesTailwind([`@tailwindcss/typography`])).toBe(false);
99
- });
100
- });
101
-
102
- // Keep component-overlap cases explicit when stems must not form a family.
103
- describe(`the name two components share`, () => {
104
- test(`framework and qualifier noise falls away`, () => {
105
- expect(componentStem(`src/components/Button.vue`)).toBe(`button`);
106
- expect(componentStem(`src/ui/BaseButton.vue`)).toBe(`button`);
107
- expect(componentStem(`src/legacy/ButtonV2.tsx`)).toBe(`button`);
108
- expect(componentStem(`src/app/user-card.component.ts`)).toBe(`usercard`);
109
- expect(componentStem(`src/UserCard.tsx`)).toBe(`usercard`);
110
- });
111
-
112
- test(`index files never form a family`, () => {
113
- expect(componentStem(`src/components/Button/index.tsx`)).toBeUndefined();
114
- });
115
-
116
- test(`framework entry names never form a family`, () => {
117
- expect(componentStem(`apps/web/src/App.vue`)).toBeUndefined();
118
- expect(componentStem(`apps/desktop/src/App.vue`)).toBeUndefined();
119
- expect(componentStem(`app/dashboard/page.tsx`)).toBeUndefined();
120
- expect(componentStem(`app/settings/layout.tsx`)).toBeUndefined();
121
- expect(componentStem(`app/settings/not-found.tsx`)).toBeUndefined();
122
- });
123
-
124
- test(`a component that only starts with a framework name is kept`, () => {
125
- expect(componentStem(`src/shell/AppShell.vue`)).toBe(`appshell`);
126
- expect(componentStem(`src/ErrorBoundary.tsx`)).toBe(`errorboundary`);
127
- expect(componentStem(`src/PageHeader.vue`)).toBe(`pageheader`);
128
- });
129
-
130
- test(`short names keep their digits rather than collapsing together`, () => {
131
- expect(componentStem(`src/type/H1.tsx`)).toBe(`h1`);
132
- expect(componentStem(`src/type/H2.tsx`)).toBe(`h2`);
133
- expect(componentStem(`src/type/H1.tsx`)).not.toBe(componentStem(`src/type/H2.tsx`));
134
- });
135
-
136
- test(`a word that merely starts with a qualifier is left alone`, () => {
137
- expect(componentStem(`src/Theme.tsx`)).toBe(`theme`);
138
- expect(componentStem(`src/TheHeader.vue`)).toBe(`header`);
139
- });
140
- });