cuetra 0.1.3 → 0.1.5

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 (620) hide show
  1. package/cli/README.md +81 -0
  2. package/cli/bin/cuetra.js +140 -0
  3. package/cli/lib/commands.js +215 -0
  4. package/cli/lib/licence.js +485 -0
  5. package/cli/lib/pack.js +162 -0
  6. package/cli/lib/physics.js +191 -0
  7. package/cli/package.json +13 -0
  8. package/mcp-server/README.md +78 -0
  9. package/mcp-server/bin/cuetra-mcp.js +130 -0
  10. package/mcp-server/lib/licence.js +485 -0
  11. package/mcp-server/lib/pack.js +132 -0
  12. package/mcp-server/lib/tools.js +245 -0
  13. package/mcp-server/pack/activity.svg +1 -0
  14. package/mcp-server/pack/airplay.svg +1 -0
  15. package/mcp-server/pack/anchor.svg +1 -0
  16. package/mcp-server/pack/aperture.svg +1 -0
  17. package/mcp-server/pack/arrow-right.svg +1 -0
  18. package/mcp-server/pack/arrow-up.svg +1 -0
  19. package/mcp-server/pack/award.svg +1 -0
  20. package/mcp-server/pack/badge-check.svg +1 -0
  21. package/mcp-server/pack/battery.svg +1 -0
  22. package/mcp-server/pack/bell-ring.svg +1 -0
  23. package/mcp-server/pack/bell.svg +1 -0
  24. package/mcp-server/pack/bike.svg +1 -0
  25. package/mcp-server/pack/blocks.svg +1 -0
  26. package/mcp-server/pack/bluetooth.svg +1 -0
  27. package/mcp-server/pack/book-open.svg +1 -0
  28. package/mcp-server/pack/book.svg +1 -0
  29. package/mcp-server/pack/bookmark.svg +1 -0
  30. package/mcp-server/pack/box.svg +1 -0
  31. package/mcp-server/pack/brain.svg +1 -0
  32. package/mcp-server/pack/briefcase.svg +1 -0
  33. package/mcp-server/pack/bug.svg +1 -0
  34. package/mcp-server/pack/bus.svg +1 -0
  35. package/mcp-server/pack/calculator.svg +1 -0
  36. package/mcp-server/pack/calendar.svg +1 -0
  37. package/mcp-server/pack/camera.svg +1 -0
  38. package/mcp-server/pack/car.svg +1 -0
  39. package/mcp-server/pack/check.svg +1 -0
  40. package/mcp-server/pack/chevron-down.svg +1 -0
  41. package/mcp-server/pack/circle-alert.svg +1 -0
  42. package/mcp-server/pack/circle-check.svg +1 -0
  43. package/mcp-server/pack/clipboard.svg +1 -0
  44. package/mcp-server/pack/clock.svg +1 -0
  45. package/mcp-server/pack/cloud.svg +1 -0
  46. package/mcp-server/pack/code.svg +1 -0
  47. package/mcp-server/pack/coffee.svg +1 -0
  48. package/mcp-server/pack/command.svg +1 -0
  49. package/mcp-server/pack/compass.svg +1 -0
  50. package/mcp-server/pack/cookie.svg +1 -0
  51. package/mcp-server/pack/copy.svg +1 -0
  52. package/mcp-server/pack/cpu.svg +1 -0
  53. package/mcp-server/pack/credit-card.svg +1 -0
  54. package/mcp-server/pack/crown.svg +1 -0
  55. package/mcp-server/pack/database.svg +1 -0
  56. package/mcp-server/pack/diamond.svg +1 -0
  57. package/mcp-server/pack/download.svg +1 -0
  58. package/mcp-server/pack/external-link.svg +1 -0
  59. package/mcp-server/pack/eye.svg +1 -0
  60. package/mcp-server/pack/file.svg +1 -0
  61. package/mcp-server/pack/flag.svg +1 -0
  62. package/mcp-server/pack/flame.svg +1 -0
  63. package/mcp-server/pack/folder.svg +1 -0
  64. package/mcp-server/pack/free-list.json +113 -0
  65. package/mcp-server/pack/gift.svg +1 -0
  66. package/mcp-server/pack/globe.svg +1 -0
  67. package/mcp-server/pack/headphones.svg +1 -0
  68. package/mcp-server/pack/heart.svg +1 -0
  69. package/mcp-server/pack/image.svg +1 -0
  70. package/mcp-server/pack/key.svg +1 -0
  71. package/mcp-server/pack/layers.svg +1 -0
  72. package/mcp-server/pack/link.svg +1 -0
  73. package/mcp-server/pack/list.svg +1 -0
  74. package/mcp-server/pack/lock-open.svg +1 -0
  75. package/mcp-server/pack/lock.svg +1 -0
  76. package/mcp-server/pack/mail.svg +1 -0
  77. package/mcp-server/pack/menu.svg +1 -0
  78. package/mcp-server/pack/message-square.svg +1 -0
  79. package/mcp-server/pack/mic.svg +1 -0
  80. package/mcp-server/pack/minus.svg +1 -0
  81. package/mcp-server/pack/monitor.svg +1 -0
  82. package/mcp-server/pack/moon.svg +1 -0
  83. package/mcp-server/pack/motion.json +1 -0
  84. package/mcp-server/pack/navigation.svg +1 -0
  85. package/mcp-server/pack/pause.svg +1 -0
  86. package/mcp-server/pack/pen.svg +1 -0
  87. package/mcp-server/pack/phone.svg +1 -0
  88. package/mcp-server/pack/play.svg +1 -0
  89. package/mcp-server/pack/plus.svg +1 -0
  90. package/mcp-server/pack/power.svg +1 -0
  91. package/mcp-server/pack/printer.svg +1 -0
  92. package/mcp-server/pack/refresh-cw.svg +1 -0
  93. package/mcp-server/pack/rocket.svg +1 -0
  94. package/mcp-server/pack/search.svg +1 -0
  95. package/mcp-server/pack/send.svg +1 -0
  96. package/mcp-server/pack/settings.svg +1 -0
  97. package/mcp-server/pack/shield-check.svg +1 -0
  98. package/mcp-server/pack/shopping-cart.svg +1 -0
  99. package/mcp-server/pack/smartphone.svg +1 -0
  100. package/mcp-server/pack/star.svg +1 -0
  101. package/mcp-server/pack/sun.svg +1 -0
  102. package/mcp-server/pack/tag.svg +1 -0
  103. package/mcp-server/pack/terminal.svg +1 -0
  104. package/mcp-server/pack/thumbs-up.svg +1 -0
  105. package/mcp-server/pack/trash.svg +1 -0
  106. package/mcp-server/pack/trending-up.svg +1 -0
  107. package/mcp-server/pack/umbrella.svg +1 -0
  108. package/mcp-server/pack/upload.svg +1 -0
  109. package/mcp-server/pack/user.svg +1 -0
  110. package/mcp-server/pack/users.svg +1 -0
  111. package/mcp-server/pack/volume.svg +1 -0
  112. package/mcp-server/pack/watch.svg +1 -0
  113. package/mcp-server/pack/x.svg +1 -0
  114. package/mcp-server/pack/zap.svg +1 -0
  115. package/mcp-server/package.json +13 -0
  116. package/motion.json +1 -1
  117. package/pack/activity.svg +1 -0
  118. package/pack/airplay.svg +1 -0
  119. package/pack/anchor.svg +1 -0
  120. package/pack/aperture.svg +1 -0
  121. package/pack/arrow-right.svg +1 -0
  122. package/pack/arrow-up.svg +1 -0
  123. package/pack/award.svg +1 -0
  124. package/pack/badge-check.svg +1 -0
  125. package/pack/battery.svg +1 -0
  126. package/pack/bell-ring.svg +1 -0
  127. package/pack/bell.svg +1 -0
  128. package/pack/bike.svg +1 -0
  129. package/pack/blocks.svg +1 -0
  130. package/pack/bluetooth.svg +1 -0
  131. package/pack/book-open.svg +1 -0
  132. package/pack/book.svg +1 -0
  133. package/pack/bookmark.svg +1 -0
  134. package/pack/box.svg +1 -0
  135. package/pack/brain.svg +1 -0
  136. package/pack/briefcase.svg +1 -0
  137. package/pack/bug.svg +1 -0
  138. package/pack/bus.svg +1 -0
  139. package/pack/calculator.svg +1 -0
  140. package/pack/calendar.svg +1 -0
  141. package/pack/camera.svg +1 -0
  142. package/pack/car.svg +1 -0
  143. package/pack/check.svg +1 -0
  144. package/pack/chevron-down.svg +1 -0
  145. package/pack/circle-alert.svg +1 -0
  146. package/pack/circle-check.svg +1 -0
  147. package/pack/clipboard.svg +1 -0
  148. package/pack/clock.svg +1 -0
  149. package/pack/cloud.svg +1 -0
  150. package/pack/code.svg +1 -0
  151. package/pack/coffee.svg +1 -0
  152. package/pack/command.svg +1 -0
  153. package/pack/compass.svg +1 -0
  154. package/pack/cookie.svg +1 -0
  155. package/pack/copy.svg +1 -0
  156. package/pack/cpu.svg +1 -0
  157. package/pack/credit-card.svg +1 -0
  158. package/pack/crown.svg +1 -0
  159. package/pack/database.svg +1 -0
  160. package/pack/diamond.svg +1 -0
  161. package/pack/download.svg +1 -0
  162. package/pack/duotone/activity.svg +1 -0
  163. package/pack/duotone/airplay.svg +1 -0
  164. package/pack/duotone/anchor.svg +1 -0
  165. package/pack/duotone/aperture.svg +1 -0
  166. package/pack/duotone/arrow-right.svg +1 -0
  167. package/pack/duotone/arrow-up.svg +1 -0
  168. package/pack/duotone/award.svg +1 -0
  169. package/pack/duotone/badge-check.svg +1 -0
  170. package/pack/duotone/battery.svg +1 -0
  171. package/pack/duotone/bell-ring.svg +1 -0
  172. package/pack/duotone/bell.svg +1 -0
  173. package/pack/duotone/bike.svg +1 -0
  174. package/pack/duotone/blocks.svg +1 -0
  175. package/pack/duotone/bluetooth.svg +1 -0
  176. package/pack/duotone/book-open.svg +1 -0
  177. package/pack/duotone/book.svg +1 -0
  178. package/pack/duotone/bookmark.svg +1 -0
  179. package/pack/duotone/box.svg +1 -0
  180. package/pack/duotone/brain.svg +1 -0
  181. package/pack/duotone/briefcase.svg +1 -0
  182. package/pack/duotone/bug.svg +1 -0
  183. package/pack/duotone/bus.svg +1 -0
  184. package/pack/duotone/calculator.svg +1 -0
  185. package/pack/duotone/calendar.svg +1 -0
  186. package/pack/duotone/camera.svg +1 -0
  187. package/pack/duotone/car.svg +1 -0
  188. package/pack/duotone/check.svg +1 -0
  189. package/pack/duotone/chevron-down.svg +1 -0
  190. package/pack/duotone/circle-alert.svg +1 -0
  191. package/pack/duotone/circle-check.svg +1 -0
  192. package/pack/duotone/clipboard.svg +1 -0
  193. package/pack/duotone/clock.svg +1 -0
  194. package/pack/duotone/cloud.svg +1 -0
  195. package/pack/duotone/code.svg +1 -0
  196. package/pack/duotone/coffee.svg +1 -0
  197. package/pack/duotone/command.svg +1 -0
  198. package/pack/duotone/compass.svg +1 -0
  199. package/pack/duotone/cookie.svg +1 -0
  200. package/pack/duotone/copy.svg +1 -0
  201. package/pack/duotone/cpu.svg +1 -0
  202. package/pack/duotone/credit-card.svg +1 -0
  203. package/pack/duotone/crown.svg +1 -0
  204. package/pack/duotone/database.svg +1 -0
  205. package/pack/duotone/diamond.svg +1 -0
  206. package/pack/duotone/download.svg +1 -0
  207. package/pack/duotone/external-link.svg +1 -0
  208. package/pack/duotone/eye.svg +1 -0
  209. package/pack/duotone/file.svg +1 -0
  210. package/pack/duotone/flag.svg +1 -0
  211. package/pack/duotone/flame.svg +1 -0
  212. package/pack/duotone/folder.svg +1 -0
  213. package/pack/duotone/gift.svg +1 -0
  214. package/pack/duotone/globe.svg +1 -0
  215. package/pack/duotone/headphones.svg +1 -0
  216. package/pack/duotone/heart.svg +1 -0
  217. package/pack/duotone/image.svg +1 -0
  218. package/pack/duotone/key.svg +1 -0
  219. package/pack/duotone/layers.svg +1 -0
  220. package/pack/duotone/link.svg +1 -0
  221. package/pack/duotone/list.svg +1 -0
  222. package/pack/duotone/lock-open.svg +1 -0
  223. package/pack/duotone/lock.svg +1 -0
  224. package/pack/duotone/mail.svg +1 -0
  225. package/pack/duotone/menu.svg +1 -0
  226. package/pack/duotone/message-square.svg +1 -0
  227. package/pack/duotone/mic.svg +1 -0
  228. package/pack/duotone/minus.svg +1 -0
  229. package/pack/duotone/monitor.svg +1 -0
  230. package/pack/duotone/moon.svg +1 -0
  231. package/pack/duotone/navigation.svg +1 -0
  232. package/pack/duotone/pause.svg +1 -0
  233. package/pack/duotone/pen.svg +1 -0
  234. package/pack/duotone/phone.svg +1 -0
  235. package/pack/duotone/play.svg +1 -0
  236. package/pack/duotone/plus.svg +1 -0
  237. package/pack/duotone/power.svg +1 -0
  238. package/pack/duotone/printer.svg +1 -0
  239. package/pack/duotone/refresh-cw.svg +1 -0
  240. package/pack/duotone/rocket.svg +1 -0
  241. package/pack/duotone/search.svg +1 -0
  242. package/pack/duotone/send.svg +1 -0
  243. package/pack/duotone/settings.svg +1 -0
  244. package/pack/duotone/shield-check.svg +1 -0
  245. package/pack/duotone/shopping-cart.svg +1 -0
  246. package/pack/duotone/smartphone.svg +1 -0
  247. package/pack/duotone/star.svg +1 -0
  248. package/pack/duotone/sun.svg +1 -0
  249. package/pack/duotone/tag.svg +1 -0
  250. package/pack/duotone/terminal.svg +1 -0
  251. package/pack/duotone/thumbs-up.svg +1 -0
  252. package/pack/duotone/trash.svg +1 -0
  253. package/pack/duotone/trending-up.svg +1 -0
  254. package/pack/duotone/umbrella.svg +1 -0
  255. package/pack/duotone/upload.svg +1 -0
  256. package/pack/duotone/user.svg +1 -0
  257. package/pack/duotone/users.svg +1 -0
  258. package/pack/duotone/volume.svg +1 -0
  259. package/pack/duotone/watch.svg +1 -0
  260. package/pack/duotone/x.svg +1 -0
  261. package/pack/duotone/zap.svg +1 -0
  262. package/pack/external-link.svg +1 -0
  263. package/pack/eye.svg +1 -0
  264. package/pack/file.svg +1 -0
  265. package/pack/flag.svg +1 -0
  266. package/pack/flame.svg +1 -0
  267. package/pack/folder.svg +1 -0
  268. package/pack/free-list.json +113 -0
  269. package/pack/gift.svg +1 -0
  270. package/pack/glass/activity.svg +1 -0
  271. package/pack/glass/airplay.svg +1 -0
  272. package/pack/glass/anchor.svg +1 -0
  273. package/pack/glass/aperture.svg +1 -0
  274. package/pack/glass/arrow-right.svg +1 -0
  275. package/pack/glass/arrow-up.svg +1 -0
  276. package/pack/glass/award.svg +1 -0
  277. package/pack/glass/badge-check.svg +1 -0
  278. package/pack/glass/battery.svg +1 -0
  279. package/pack/glass/bell-ring.svg +1 -0
  280. package/pack/glass/bell.svg +1 -0
  281. package/pack/glass/bike.svg +1 -0
  282. package/pack/glass/blocks.svg +1 -0
  283. package/pack/glass/bluetooth.svg +1 -0
  284. package/pack/glass/book-open.svg +1 -0
  285. package/pack/glass/book.svg +1 -0
  286. package/pack/glass/bookmark.svg +1 -0
  287. package/pack/glass/box.svg +1 -0
  288. package/pack/glass/brain.svg +1 -0
  289. package/pack/glass/briefcase.svg +1 -0
  290. package/pack/glass/bug.svg +1 -0
  291. package/pack/glass/bus.svg +1 -0
  292. package/pack/glass/calculator.svg +1 -0
  293. package/pack/glass/calendar.svg +1 -0
  294. package/pack/glass/camera.svg +1 -0
  295. package/pack/glass/car.svg +1 -0
  296. package/pack/glass/check.svg +1 -0
  297. package/pack/glass/chevron-down.svg +1 -0
  298. package/pack/glass/circle-alert.svg +1 -0
  299. package/pack/glass/circle-check.svg +1 -0
  300. package/pack/glass/clipboard.svg +1 -0
  301. package/pack/glass/clock.svg +1 -0
  302. package/pack/glass/cloud.svg +1 -0
  303. package/pack/glass/code.svg +1 -0
  304. package/pack/glass/coffee.svg +1 -0
  305. package/pack/glass/command.svg +1 -0
  306. package/pack/glass/compass.svg +1 -0
  307. package/pack/glass/cookie.svg +1 -0
  308. package/pack/glass/copy.svg +1 -0
  309. package/pack/glass/cpu.svg +1 -0
  310. package/pack/glass/credit-card.svg +1 -0
  311. package/pack/glass/crown.svg +1 -0
  312. package/pack/glass/database.svg +1 -0
  313. package/pack/glass/diamond.svg +1 -0
  314. package/pack/glass/download.svg +1 -0
  315. package/pack/glass/external-link.svg +1 -0
  316. package/pack/glass/eye.svg +1 -0
  317. package/pack/glass/file.svg +1 -0
  318. package/pack/glass/flag.svg +1 -0
  319. package/pack/glass/flame.svg +1 -0
  320. package/pack/glass/folder.svg +1 -0
  321. package/pack/glass/gift.svg +1 -0
  322. package/pack/glass/globe.svg +1 -0
  323. package/pack/glass/headphones.svg +1 -0
  324. package/pack/glass/heart.svg +1 -0
  325. package/pack/glass/image.svg +1 -0
  326. package/pack/glass/key.svg +1 -0
  327. package/pack/glass/layers.svg +1 -0
  328. package/pack/glass/link.svg +1 -0
  329. package/pack/glass/list.svg +1 -0
  330. package/pack/glass/lock-open.svg +1 -0
  331. package/pack/glass/lock.svg +1 -0
  332. package/pack/glass/mail.svg +1 -0
  333. package/pack/glass/menu.svg +1 -0
  334. package/pack/glass/message-square.svg +1 -0
  335. package/pack/glass/mic.svg +1 -0
  336. package/pack/glass/minus.svg +1 -0
  337. package/pack/glass/monitor.svg +1 -0
  338. package/pack/glass/moon.svg +1 -0
  339. package/pack/glass/navigation.svg +1 -0
  340. package/pack/glass/pause.svg +1 -0
  341. package/pack/glass/pen.svg +1 -0
  342. package/pack/glass/phone.svg +1 -0
  343. package/pack/glass/play.svg +1 -0
  344. package/pack/glass/plus.svg +1 -0
  345. package/pack/glass/power.svg +1 -0
  346. package/pack/glass/printer.svg +1 -0
  347. package/pack/glass/refresh-cw.svg +1 -0
  348. package/pack/glass/rocket.svg +1 -0
  349. package/pack/glass/search.svg +1 -0
  350. package/pack/glass/send.svg +1 -0
  351. package/pack/glass/settings.svg +1 -0
  352. package/pack/glass/shield-check.svg +1 -0
  353. package/pack/glass/shopping-cart.svg +1 -0
  354. package/pack/glass/smartphone.svg +1 -0
  355. package/pack/glass/star.svg +1 -0
  356. package/pack/glass/sun.svg +1 -0
  357. package/pack/glass/tag.svg +1 -0
  358. package/pack/glass/terminal.svg +1 -0
  359. package/pack/glass/thumbs-up.svg +1 -0
  360. package/pack/glass/trash.svg +1 -0
  361. package/pack/glass/trending-up.svg +1 -0
  362. package/pack/glass/umbrella.svg +1 -0
  363. package/pack/glass/upload.svg +1 -0
  364. package/pack/glass/user.svg +1 -0
  365. package/pack/glass/users.svg +1 -0
  366. package/pack/glass/volume.svg +1 -0
  367. package/pack/glass/watch.svg +1 -0
  368. package/pack/glass/x.svg +1 -0
  369. package/pack/glass/zap.svg +1 -0
  370. package/pack/globe.svg +1 -0
  371. package/pack/headphones.svg +1 -0
  372. package/pack/heart.svg +1 -0
  373. package/pack/image.svg +1 -0
  374. package/pack/key.svg +1 -0
  375. package/pack/layers.svg +1 -0
  376. package/pack/link.svg +1 -0
  377. package/pack/list.svg +1 -0
  378. package/pack/lock-open.svg +1 -0
  379. package/pack/lock.svg +1 -0
  380. package/pack/mail.svg +1 -0
  381. package/pack/menu.svg +1 -0
  382. package/pack/message-square.svg +1 -0
  383. package/pack/mic.svg +1 -0
  384. package/pack/minus.svg +1 -0
  385. package/pack/monitor.svg +1 -0
  386. package/pack/moon.svg +1 -0
  387. package/pack/motion.json +1 -0
  388. package/pack/navigation.svg +1 -0
  389. package/pack/outline/activity.svg +1 -0
  390. package/pack/outline/airplay.svg +1 -0
  391. package/pack/outline/anchor.svg +1 -0
  392. package/pack/outline/aperture.svg +1 -0
  393. package/pack/outline/arrow-right.svg +1 -0
  394. package/pack/outline/arrow-up.svg +1 -0
  395. package/pack/outline/award.svg +1 -0
  396. package/pack/outline/badge-check.svg +1 -0
  397. package/pack/outline/battery.svg +1 -0
  398. package/pack/outline/bell-ring.svg +1 -0
  399. package/pack/outline/bell.svg +1 -0
  400. package/pack/outline/bike.svg +1 -0
  401. package/pack/outline/blocks.svg +1 -0
  402. package/pack/outline/bluetooth.svg +1 -0
  403. package/pack/outline/book-open.svg +1 -0
  404. package/pack/outline/book.svg +1 -0
  405. package/pack/outline/bookmark.svg +1 -0
  406. package/pack/outline/box.svg +1 -0
  407. package/pack/outline/brain.svg +1 -0
  408. package/pack/outline/briefcase.svg +1 -0
  409. package/pack/outline/bug.svg +1 -0
  410. package/pack/outline/bus.svg +1 -0
  411. package/pack/outline/calculator.svg +1 -0
  412. package/pack/outline/calendar.svg +1 -0
  413. package/pack/outline/camera.svg +1 -0
  414. package/pack/outline/car.svg +1 -0
  415. package/pack/outline/check.svg +1 -0
  416. package/pack/outline/chevron-down.svg +1 -0
  417. package/pack/outline/circle-alert.svg +1 -0
  418. package/pack/outline/circle-check.svg +1 -0
  419. package/pack/outline/clipboard.svg +1 -0
  420. package/pack/outline/clock.svg +1 -0
  421. package/pack/outline/cloud.svg +1 -0
  422. package/pack/outline/code.svg +1 -0
  423. package/pack/outline/coffee.svg +1 -0
  424. package/pack/outline/command.svg +1 -0
  425. package/pack/outline/compass.svg +1 -0
  426. package/pack/outline/cookie.svg +1 -0
  427. package/pack/outline/copy.svg +1 -0
  428. package/pack/outline/cpu.svg +1 -0
  429. package/pack/outline/credit-card.svg +1 -0
  430. package/pack/outline/crown.svg +1 -0
  431. package/pack/outline/database.svg +1 -0
  432. package/pack/outline/diamond.svg +1 -0
  433. package/pack/outline/download.svg +1 -0
  434. package/pack/outline/external-link.svg +1 -0
  435. package/pack/outline/eye.svg +1 -0
  436. package/pack/outline/file.svg +1 -0
  437. package/pack/outline/flag.svg +1 -0
  438. package/pack/outline/flame.svg +1 -0
  439. package/pack/outline/folder.svg +1 -0
  440. package/pack/outline/gift.svg +1 -0
  441. package/pack/outline/globe.svg +1 -0
  442. package/pack/outline/headphones.svg +1 -0
  443. package/pack/outline/heart.svg +1 -0
  444. package/pack/outline/image.svg +1 -0
  445. package/pack/outline/key.svg +1 -0
  446. package/pack/outline/layers.svg +1 -0
  447. package/pack/outline/link.svg +1 -0
  448. package/pack/outline/list.svg +1 -0
  449. package/pack/outline/lock-open.svg +1 -0
  450. package/pack/outline/lock.svg +1 -0
  451. package/pack/outline/mail.svg +1 -0
  452. package/pack/outline/menu.svg +1 -0
  453. package/pack/outline/message-square.svg +1 -0
  454. package/pack/outline/mic.svg +1 -0
  455. package/pack/outline/minus.svg +1 -0
  456. package/pack/outline/monitor.svg +1 -0
  457. package/pack/outline/moon.svg +1 -0
  458. package/pack/outline/navigation.svg +1 -0
  459. package/pack/outline/pause.svg +1 -0
  460. package/pack/outline/pen.svg +1 -0
  461. package/pack/outline/phone.svg +1 -0
  462. package/pack/outline/play.svg +1 -0
  463. package/pack/outline/plus.svg +1 -0
  464. package/pack/outline/power.svg +1 -0
  465. package/pack/outline/printer.svg +1 -0
  466. package/pack/outline/refresh-cw.svg +1 -0
  467. package/pack/outline/rocket.svg +1 -0
  468. package/pack/outline/search.svg +1 -0
  469. package/pack/outline/send.svg +1 -0
  470. package/pack/outline/settings.svg +1 -0
  471. package/pack/outline/shield-check.svg +1 -0
  472. package/pack/outline/shopping-cart.svg +1 -0
  473. package/pack/outline/smartphone.svg +1 -0
  474. package/pack/outline/star.svg +1 -0
  475. package/pack/outline/sun.svg +1 -0
  476. package/pack/outline/tag.svg +1 -0
  477. package/pack/outline/terminal.svg +1 -0
  478. package/pack/outline/thumbs-up.svg +1 -0
  479. package/pack/outline/trash.svg +1 -0
  480. package/pack/outline/trending-up.svg +1 -0
  481. package/pack/outline/umbrella.svg +1 -0
  482. package/pack/outline/upload.svg +1 -0
  483. package/pack/outline/user.svg +1 -0
  484. package/pack/outline/users.svg +1 -0
  485. package/pack/outline/volume.svg +1 -0
  486. package/pack/outline/watch.svg +1 -0
  487. package/pack/outline/x.svg +1 -0
  488. package/pack/outline/zap.svg +1 -0
  489. package/pack/pause.svg +1 -0
  490. package/pack/pen.svg +1 -0
  491. package/pack/phone.svg +1 -0
  492. package/pack/play.svg +1 -0
  493. package/pack/plus.svg +1 -0
  494. package/pack/power.svg +1 -0
  495. package/pack/printer.svg +1 -0
  496. package/pack/refresh-cw.svg +1 -0
  497. package/pack/rocket.svg +1 -0
  498. package/pack/search.svg +1 -0
  499. package/pack/send.svg +1 -0
  500. package/pack/settings.svg +1 -0
  501. package/pack/shield-check.svg +1 -0
  502. package/pack/shopping-cart.svg +1 -0
  503. package/pack/smartphone.svg +1 -0
  504. package/pack/solid/activity.svg +1 -0
  505. package/pack/solid/airplay.svg +1 -0
  506. package/pack/solid/anchor.svg +1 -0
  507. package/pack/solid/aperture.svg +1 -0
  508. package/pack/solid/arrow-right.svg +1 -0
  509. package/pack/solid/arrow-up.svg +1 -0
  510. package/pack/solid/award.svg +1 -0
  511. package/pack/solid/badge-check.svg +1 -0
  512. package/pack/solid/battery.svg +1 -0
  513. package/pack/solid/bell-ring.svg +1 -0
  514. package/pack/solid/bell.svg +1 -0
  515. package/pack/solid/bike.svg +1 -0
  516. package/pack/solid/blocks.svg +1 -0
  517. package/pack/solid/bluetooth.svg +1 -0
  518. package/pack/solid/book-open.svg +1 -0
  519. package/pack/solid/book.svg +1 -0
  520. package/pack/solid/bookmark.svg +1 -0
  521. package/pack/solid/box.svg +1 -0
  522. package/pack/solid/brain.svg +1 -0
  523. package/pack/solid/briefcase.svg +1 -0
  524. package/pack/solid/bug.svg +1 -0
  525. package/pack/solid/bus.svg +1 -0
  526. package/pack/solid/calculator.svg +1 -0
  527. package/pack/solid/calendar.svg +1 -0
  528. package/pack/solid/camera.svg +1 -0
  529. package/pack/solid/car.svg +1 -0
  530. package/pack/solid/check.svg +1 -0
  531. package/pack/solid/chevron-down.svg +1 -0
  532. package/pack/solid/circle-alert.svg +1 -0
  533. package/pack/solid/circle-check.svg +1 -0
  534. package/pack/solid/clipboard.svg +1 -0
  535. package/pack/solid/clock.svg +1 -0
  536. package/pack/solid/cloud.svg +1 -0
  537. package/pack/solid/code.svg +1 -0
  538. package/pack/solid/coffee.svg +1 -0
  539. package/pack/solid/command.svg +1 -0
  540. package/pack/solid/compass.svg +1 -0
  541. package/pack/solid/cookie.svg +1 -0
  542. package/pack/solid/copy.svg +1 -0
  543. package/pack/solid/cpu.svg +1 -0
  544. package/pack/solid/credit-card.svg +1 -0
  545. package/pack/solid/crown.svg +1 -0
  546. package/pack/solid/database.svg +1 -0
  547. package/pack/solid/diamond.svg +1 -0
  548. package/pack/solid/download.svg +1 -0
  549. package/pack/solid/external-link.svg +1 -0
  550. package/pack/solid/eye.svg +1 -0
  551. package/pack/solid/file.svg +1 -0
  552. package/pack/solid/flag.svg +1 -0
  553. package/pack/solid/flame.svg +1 -0
  554. package/pack/solid/folder.svg +1 -0
  555. package/pack/solid/gift.svg +1 -0
  556. package/pack/solid/globe.svg +1 -0
  557. package/pack/solid/headphones.svg +1 -0
  558. package/pack/solid/heart.svg +1 -0
  559. package/pack/solid/image.svg +1 -0
  560. package/pack/solid/key.svg +1 -0
  561. package/pack/solid/layers.svg +1 -0
  562. package/pack/solid/link.svg +1 -0
  563. package/pack/solid/list.svg +1 -0
  564. package/pack/solid/lock-open.svg +1 -0
  565. package/pack/solid/lock.svg +1 -0
  566. package/pack/solid/mail.svg +1 -0
  567. package/pack/solid/menu.svg +1 -0
  568. package/pack/solid/message-square.svg +1 -0
  569. package/pack/solid/mic.svg +1 -0
  570. package/pack/solid/minus.svg +1 -0
  571. package/pack/solid/monitor.svg +1 -0
  572. package/pack/solid/moon.svg +1 -0
  573. package/pack/solid/navigation.svg +1 -0
  574. package/pack/solid/pause.svg +1 -0
  575. package/pack/solid/pen.svg +1 -0
  576. package/pack/solid/phone.svg +1 -0
  577. package/pack/solid/play.svg +1 -0
  578. package/pack/solid/plus.svg +1 -0
  579. package/pack/solid/power.svg +1 -0
  580. package/pack/solid/printer.svg +1 -0
  581. package/pack/solid/refresh-cw.svg +1 -0
  582. package/pack/solid/rocket.svg +1 -0
  583. package/pack/solid/search.svg +1 -0
  584. package/pack/solid/send.svg +1 -0
  585. package/pack/solid/settings.svg +1 -0
  586. package/pack/solid/shield-check.svg +1 -0
  587. package/pack/solid/shopping-cart.svg +1 -0
  588. package/pack/solid/smartphone.svg +1 -0
  589. package/pack/solid/star.svg +1 -0
  590. package/pack/solid/sun.svg +1 -0
  591. package/pack/solid/tag.svg +1 -0
  592. package/pack/solid/terminal.svg +1 -0
  593. package/pack/solid/thumbs-up.svg +1 -0
  594. package/pack/solid/trash.svg +1 -0
  595. package/pack/solid/trending-up.svg +1 -0
  596. package/pack/solid/umbrella.svg +1 -0
  597. package/pack/solid/upload.svg +1 -0
  598. package/pack/solid/user.svg +1 -0
  599. package/pack/solid/users.svg +1 -0
  600. package/pack/solid/volume.svg +1 -0
  601. package/pack/solid/watch.svg +1 -0
  602. package/pack/solid/x.svg +1 -0
  603. package/pack/solid/zap.svg +1 -0
  604. package/pack/star.svg +1 -0
  605. package/pack/sun.svg +1 -0
  606. package/pack/tag.svg +1 -0
  607. package/pack/terminal.svg +1 -0
  608. package/pack/thumbs-up.svg +1 -0
  609. package/pack/trash.svg +1 -0
  610. package/pack/trending-up.svg +1 -0
  611. package/pack/umbrella.svg +1 -0
  612. package/pack/upload.svg +1 -0
  613. package/pack/user.svg +1 -0
  614. package/pack/users.svg +1 -0
  615. package/pack/volume.svg +1 -0
  616. package/pack/watch.svg +1 -0
  617. package/pack/x.svg +1 -0
  618. package/pack/zap.svg +1 -0
  619. package/package.json +27 -18
  620. package/src/licence.js +98 -0
package/cli/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # @cuetra/cli
2
+
3
+ Kinetic icon CLI. Zero npm dependencies; runs on plain Node (>= 20).
4
+
5
+ ```bash
6
+ node cli/bin/cuetra.js add bell
7
+ node cli/bin/cuetra.js preview bell
8
+ node cli/bin/cuetra.js audit ./icons/bell.svg
9
+ node cli/bin/cuetra.js add bell --treatment glass --out ./icons
10
+ node cli/bin/cuetra.js add bell --pace showcase
11
+ node cli/bin/cuetra.js show bell
12
+ node cli/bin/cuetra.js list
13
+ node cli/bin/cuetra.js help
14
+ ```
15
+
16
+ - `add` writes the icon's kinetic SVG into `--out` (default `./icons`) and prints its
17
+ motion line. Default keeps all four treatment groups (what the runtime expects);
18
+ `--treatment <name>` extracts one group.
19
+ - `preview` prints the icon's motion map from motion.json: archetype, duration,
20
+ amplitude, easing, the full part list, strike timing, coupling and voice.
21
+ - `audit` checks a kinetic SVG file (pack-shipped or customised) against the frozen
22
+ physics bar - 20deg rotation cap incl. followers, visibility floors (rot/skew >= 5deg,
23
+ scale >= 0.10, travel >= 2.0px @24), the 240-420 ms ui band, motion ending exactly at
24
+ rest - and against the motion.json record its `data-icon` claims (treatments, part
25
+ counts, per-part delays intact). PASS prints the checked numbers; FAIL lists each
26
+ violated rule and exits non-zero. Strike-on-beat timing is runtime-verified
27
+ separately - not statically checkable from a record + SVG, so audit never judges it.
28
+ Physics bar source: MOTION-MODEL.md; floor aggregation follows the shipped census
29
+ method (icon peak over all parts, PIPE/out/MOTION-CENSUS.md).
30
+ - `--pace ui|showcase` applies the runtime's pace policy (`src/cuetra-motion.js`) to the
31
+ printed duration/amplitude. Every motion value itself is read from the pack's
32
+ `motion.json` at run time - nothing is duplicated in the CLI.
33
+ - Without a licence key only the free sampler set (`pack/`, 100 icons) is served and the
34
+ CLI says so honestly; a non-free `add` exits non-zero.
35
+
36
+ ## Free vs paid
37
+
38
+ | | No key (free) | With a validated key |
39
+ |---|---|---|
40
+ | Icons served | free sampler set, 100 icons | the full pack from `--pack` / `CUETRA_PACK_DIR` (6,646 icons) |
41
+ | Network | never - no request is made | one online licence check per run, or none while the 7-day cache is fresh |
42
+ | Needs | nothing | `CUETRA_LICENCE_KEY` + the unpacked full pack directory |
43
+
44
+ A key comes from the purchase flow: buy the founding pack at cuetra.com through
45
+ Polar or Dodo Payments and the receipt (or cuetra.com/redeem) shows the key.
46
+ Polar keys look like `CUETRA-P-7K2M-9QF3-B9ZX`; Dodo Payments keys are
47
+ five-group codes like `2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43` - paste either one,
48
+ the CLI routes it to the processor that issued it. The full pack itself is
49
+ delivered at checkout - point `CUETRA_PACK_DIR` (or `--pack`) at the unpacked
50
+ directory you received.
51
+ A key is read from `--key <key>`, `CUETRA_LICENCE_KEY`, or `cli/licence.json`
52
+ (`{"key": "..."}`).
53
+
54
+ ## How licence validation works
55
+
56
+ Serving the full pack requires the key to PASS online validation with the
57
+ licence service that issued it - Polar for `CUETRA-...` keys, Dodo Payments for
58
+ its five-group codes. Both are public, key-as-credential endpoints - the key
59
+ itself is the credential and no secret ships with the CLI. Personal and Team
60
+ keys take one seat on first use (`activate`); Polar Business keys validate
61
+ without consuming a seat, and a Dodo key of any tier activates once per machine
62
+ and re-validates its stored activation afterwards. A Dodo key spells no tier
63
+ out, so the tier is read from the product that issued the key during the live
64
+ check and kept in the cache entry. Every successful live validation is cached
65
+ for 7 days in a key-hash-named JSON file under the OS user cache dir - never
66
+ inside the repo, and written only after a successful live check - so normal use
67
+ keeps working offline inside that window. Set `CUETRA_LICENCE_CACHE_DIR` to
68
+ move the cache (tests, CI, locked-down machines).
69
+
70
+ Every class is honest and fail-closed to the free set, with the reason on stderr:
71
+
72
+ | Class | Meaning | Paid content |
73
+ |---|---|---|
74
+ | `valid` | the issuing service accepted the key just now | served |
75
+ | `cache-valid` | a live check from the last 7 days is reused; no licence server is contacted this run | served, with a notice |
76
+ | `shape-invalid` | the key does not match a known Cuetra shape (Polar or Dodo); nothing is sent anywhere | denied |
77
+ | `rejected` | the licence service said no (unknown, revoked, expired, or every seat in use); its reason is shown | denied |
78
+ | `offline-no-cache` | the licence service could not be reached and no fresh validation is cached | denied until one online run |
79
+
80
+ Keys are masked in every message and log (`CUET...(23 chars)`); the full key never
81
+ appears in CLI output.
@@ -0,0 +1,140 @@
1
+ #!/usr/bin/env node
2
+ // Cuetra CLI entry point: parses argv, dispatches to a command in lib/commands.js and
3
+ // maps thrown command errors to process exit codes. Zero dependencies beyond Node builtins.
4
+ import path from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import { FREE_PACK_DIR } from "../lib/pack.js";
7
+ import { addCommand, listCommand, showCommand, previewCommand, auditCommand } from "../lib/commands.js";
8
+
9
+ const cliDir = path.join(path.dirname(fileURLToPath(import.meta.url)), "..");
10
+
11
+ const HELP_TEXT = `cuetra - kinetic icon CLI (free sampler: 100 icons, full library: 6,646)
12
+
13
+ Usage:
14
+ cuetra add <icon> [--treatment outline|solid|duotone|glass] [--out <dir>]
15
+ [--pace ui|showcase] [--pack <dir>] [--key <key>]
16
+ cuetra preview <icon> [--pace ui|showcase] [--pack <dir>] [--key <key>]
17
+ cuetra audit <file.svg> [--pack <dir>] [--key <key>]
18
+ cuetra show <icon> [--pack <dir>] [--key <key>]
19
+ cuetra list [--pack <dir>] [--key <key>]
20
+ cuetra help
21
+
22
+ Commands:
23
+ add Write an icon's kinetic SVG into --out (default ./icons) and print its
24
+ motion line: archetype, paced duration, amplitude, easing, parts, treatments.
25
+ Default keeps all four treatments in one file, exactly as the runtime expects.
26
+ --treatment extracts a single treatment group.
27
+ preview Print the icon's motion map from motion.json: archetype, duration,
28
+ amplitude, easing, the full part list, strike timing, coupling and voice.
29
+ audit Audit a kinetic SVG file (pack-shipped or customised) against the frozen
30
+ physics bar - 20deg rotation cap incl. followers, visibility floors
31
+ (rot/skew >= 5deg, scale >= 0.10, travel >= 2.0px @24), the 240-420 ms ui
32
+ band, motion ending exactly at rest - and against the motion.json record
33
+ its data-icon claims (treatments, part counts, delays intact).
34
+ PASS prints the checked numbers; FAIL lists each violated rule. Exits
35
+ non-zero on fail. Strike-on-beat timing is runtime-verified separately -
36
+ not statically checkable from a record + SVG, so audit never judges it.
37
+ show Print the icon's full motion record from motion.json.
38
+ list Print every icon name in the served pack.
39
+
40
+ Licence:
41
+ Without a key only the free sampler set (../pack, 100 icons) is served, and the
42
+ CLI says so. A key is read from --key, the CUETRA_LICENCE_KEY environment
43
+ variable, or cli/licence.json ({"key": "..."}). A full pack (--pack or
44
+ CUETRA_PACK_DIR, the unpacked pack you received) is paid content: serving it
45
+ requires the key to PASS online validation with the processor that issued it -
46
+ Polar (CUETRA-... keys) or Dodo Payments (five-group keys), the same licence
47
+ services the site's redeem flow uses. Personal and Team keys take one seat on
48
+ first use; every successful validation is cached for 7 days, so normal use
49
+ works offline within that window. A malformed key, a rejection, or no
50
+ network and no fresh cache falls back to the free set and says exactly why.
51
+
52
+ Pace:
53
+ --pace ui (default) reports the shipped 240-420 ms band; --pace showcase applies
54
+ the runtime's 1.75x duration / 1.4x amplitude showcase policy to the report.
55
+ Motion values themselves always come from the pack's motion.json.
56
+
57
+ Examples:
58
+ cuetra add bell
59
+ cuetra add bell --treatment glass --out ./icons
60
+ cuetra add bell --pace showcase
61
+ cuetra show bell
62
+ `;
63
+
64
+ function parseArgs(argv) {
65
+ const options = {};
66
+ const positional = [];
67
+ for (let index = 0; index < argv.length; index++) {
68
+ const arg = argv[index];
69
+ if (arg === "--treatment") options.treatment = argv[++index];
70
+ else if (arg === "--out") options.out = argv[++index];
71
+ else if (arg === "--pace") options.pace = argv[++index];
72
+ else if (arg === "--pack") options.pack = argv[++index];
73
+ else if (arg === "--key") options.key = argv[++index];
74
+ else if (arg === "--help" || arg === "-h") options.help = true;
75
+ else if (arg.startsWith("--")) {
76
+ const error = new Error(`unknown option "${arg}"`);
77
+ error.exitCode = 2;
78
+ throw error;
79
+ } else positional.push(arg);
80
+ }
81
+ return { options, positional };
82
+ }
83
+
84
+ // Commands await the (possibly online) licence gate in resolvePack; help and
85
+ // usage errors return before it, so they stay instant.
86
+ async function main() {
87
+ const { options, positional } = parseArgs(process.argv.slice(2));
88
+ const [command, ...commandArgs] = positional;
89
+
90
+ if (options.help || !command || command === "help") {
91
+ process.stdout.write(HELP_TEXT);
92
+ // An explicit help request exits 0; a bare `cuetra` with no command is a usage error.
93
+ process.exitCode = (command || options.help) ? 0 : 2;
94
+ return;
95
+ }
96
+
97
+ const context = { cliDir, freePackDir: FREE_PACK_DIR };
98
+ if (command === "add") {
99
+ if (!commandArgs[0]) {
100
+ const error = new Error("add needs an icon name, e.g. cuetra add bell");
101
+ error.exitCode = 2;
102
+ throw error;
103
+ }
104
+ await addCommand(commandArgs[0], options, context);
105
+ } else if (command === "show") {
106
+ if (!commandArgs[0]) {
107
+ const error = new Error("show needs an icon name, e.g. cuetra show bell");
108
+ error.exitCode = 2;
109
+ throw error;
110
+ }
111
+ await showCommand(commandArgs[0], options, context);
112
+ } else if (command === "preview") {
113
+ if (!commandArgs[0]) {
114
+ const error = new Error("preview needs an icon name, e.g. cuetra preview bell");
115
+ error.exitCode = 2;
116
+ throw error;
117
+ }
118
+ await previewCommand(commandArgs[0], options, context);
119
+ } else if (command === "audit") {
120
+ if (!commandArgs[0]) {
121
+ const error = new Error("audit needs an SVG file path, e.g. cuetra audit ./icons/bell.svg");
122
+ error.exitCode = 2;
123
+ throw error;
124
+ }
125
+ await auditCommand(commandArgs[0], options, context);
126
+ } else if (command === "list") {
127
+ await listCommand(options, context);
128
+ } else {
129
+ const error = new Error(`unknown command "${command}" - try \`cuetra help\``);
130
+ error.exitCode = 2;
131
+ throw error;
132
+ }
133
+ }
134
+
135
+ try {
136
+ await main();
137
+ } catch (error) {
138
+ process.stderr.write(`cuetra: ${error.message}\n`);
139
+ process.exitCode = error.exitCode || 1;
140
+ }
@@ -0,0 +1,215 @@
1
+ // Implements the CLI commands: add (write a kinetic icon + report its motion line),
2
+ // show (print one icon's motion record) and list (enumerate the served set).
3
+ // Every motion value printed here is read from the pack's motion.json at run time.
4
+ // resolvePack is async because serving a full pack awaits the online licence
5
+ // validation; free runs return from it without touching the network.
6
+ import fs from "node:fs";
7
+ import path from "node:path";
8
+ import { PACE, TREATMENTS, extractTreatment, readIconSvg, resolvePack, resolveLicenceKey } from "./pack.js";
9
+ import { checkMotionRecord, checkSvgFile, unitForAxis } from "./physics.js";
10
+
11
+ const FREE_SET_SIZE = 100;
12
+
13
+ // resolvePack builds a note when it wants to tell the user something about the pack
14
+ // (a key accepted but no full pack configured, or a supplied key that failed the
15
+ // shape check). It is guidance rather than command output, so it goes to stderr.
16
+ function printPackNote(note) {
17
+ if (note) process.stderr.write(`${note}\n`);
18
+ }
19
+
20
+ export async function addCommand(iconName, options, context) {
21
+ const licenceKey = resolveLicenceKey({ flagKey: options.key, cliDir: context.cliDir });
22
+ const { pack, source, note, licensed } = await resolvePack({ packFlag: options.pack, licenceKey });
23
+
24
+ if (!(iconName in pack.map.icons)) {
25
+ const isFreePack = pack.dir === path.resolve(context.freePackDir);
26
+ if (!licensed && isFreePack) {
27
+ // The pack note carries the fail-closed reason (malformed, rejected or
28
+ // offline-unvalidatable key) - it must reach the user even though the
29
+ // command errors below.
30
+ printPackNote(note);
31
+ const message = [
32
+ `"${iconName}" is not in the free sampler set (${FREE_SET_SIZE} icons).`,
33
+ "The other 6,546 icons need a licence: set CUETRA_LICENCE_KEY (or run with --key <key>)",
34
+ "and point CUETRA_PACK_DIR at the unpacked full pack, then run the same command.",
35
+ "Free set: run `cuetra list` to see every free icon name.",
36
+ ].join("\n");
37
+ const error = new Error(message);
38
+ error.exitCode = 1;
39
+ throw error;
40
+ }
41
+ const error = new Error(`icon "${iconName}" not found in pack ${pack.dir}`);
42
+ error.exitCode = 1;
43
+ throw error;
44
+ }
45
+
46
+ const record = pack.map.icons[iconName];
47
+ const pace = PACE[options.pace] || PACE.ui;
48
+ const paceName = PACE[options.pace] ? options.pace : "ui";
49
+ const svgText = readIconSvg(pack, iconName);
50
+
51
+ let outText = svgText;
52
+ if (options.treatment) {
53
+ if (!TREATMENTS.includes(options.treatment)) {
54
+ const error = new Error(`unknown treatment "${options.treatment}" - choose one of: ${TREATMENTS.join(", ")}`);
55
+ error.exitCode = 2;
56
+ throw error;
57
+ }
58
+ if (!(record.treatments || TREATMENTS).includes(options.treatment)) {
59
+ const error = new Error(`"${iconName}" has no ${options.treatment} treatment in its motion record`);
60
+ error.exitCode = 1;
61
+ throw error;
62
+ }
63
+ const extracted = extractTreatment(svgText, options.treatment);
64
+ if (!extracted) {
65
+ const error = new Error(`no ${options.treatment} group found inside the kinetic SVG for "${iconName}"`);
66
+ error.exitCode = 1;
67
+ throw error;
68
+ }
69
+ outText = extracted;
70
+ }
71
+
72
+ const outDir = path.resolve(options.out || "icons");
73
+ fs.mkdirSync(outDir, { recursive: true });
74
+ const outPath = path.join(outDir, `${iconName}.svg`);
75
+ // Encoding discipline: the kinetic SVG is UTF-8 text and is written as UTF-8, no BOM.
76
+ fs.writeFileSync(outPath, outText, "utf8");
77
+
78
+ const durationMs = Math.round(record.duration * pace.dur);
79
+ const amplitude = (record.amp ?? record.amplitude) * pace.amp;
80
+ const parts = (record.parts || []).length;
81
+ const treatmentList = (record.treatments || TREATMENTS).join(", ");
82
+ process.stdout.write(`wrote ${outPath} (${outText.length} bytes, ${options.treatment || "all treatments"})\n`);
83
+ process.stdout.write(
84
+ `${iconName} - archetype ${record.archetype}, ${durationMs} ms at ${paceName} pace, ` +
85
+ `amplitude ${amplitude.toFixed(2)}, easing ${record.easing}, ${parts} part(s), ` +
86
+ `treatments: ${treatmentList}\n`
87
+ );
88
+ process.stdout.write(`motion source: ${path.join(pack.dir, "motion.json")}\n`);
89
+ printPackNote(note);
90
+ process.stdout.write(`pack: ${source}\n`);
91
+ }
92
+
93
+ export async function showCommand(iconName, options, context) {
94
+ const licenceKey = resolveLicenceKey({ flagKey: options.key, cliDir: context.cliDir });
95
+ const { pack, source, note } = await resolvePack({ packFlag: options.pack, licenceKey });
96
+ printPackNote(note);
97
+ if (!(iconName in pack.map.icons)) {
98
+ const error = new Error(`icon "${iconName}" not found in ${source} (${pack.dir})`);
99
+ error.exitCode = 1;
100
+ throw error;
101
+ }
102
+ const record = pack.map.icons[iconName];
103
+ process.stdout.write(JSON.stringify(record, null, 2) + "\n");
104
+ }
105
+
106
+ export async function listCommand(options, context) {
107
+ const licenceKey = resolveLicenceKey({ flagKey: options.key, cliDir: context.cliDir });
108
+ const { pack, source, note } = await resolvePack({ packFlag: options.pack, licenceKey });
109
+ printPackNote(note);
110
+ process.stdout.write(`${pack.iconNames.length} icons in ${source} (${pack.dir}):\n`);
111
+ process.stdout.write(pack.iconNames.join("\n") + "\n");
112
+ }
113
+
114
+ // Render one part's line of the preview map: role, delay, pivot, amplitude scale and,
115
+ // for coupled followers, the part they follow.
116
+ function partLine(part, index) {
117
+ const role = String(part.role || "body").padEnd(8);
118
+ const delay = Number(part.delay ?? 0);
119
+ const pivot = part.pivot || "50% 50%";
120
+ const scale = Number(part.amplitudeScale ?? 1);
121
+ const follows = part.follows === undefined ? "" : ` follows ${part.follows}`;
122
+ return ` [${index}] ${role} delay ${delay} ms pivot ${pivot} amplitudeScale ${scale.toFixed(3)}${follows}`;
123
+ }
124
+
125
+ // preview: print the icon's motion map - everything motion.json holds for one icon, in
126
+ // the readable style of add's motion line. No motion value is invented here.
127
+ export async function previewCommand(iconName, options, context) {
128
+ const licenceKey = resolveLicenceKey({ flagKey: options.key, cliDir: context.cliDir });
129
+ const { pack, source, note } = await resolvePack({ packFlag: options.pack, licenceKey });
130
+ printPackNote(note);
131
+ if (!(iconName in pack.map.icons)) {
132
+ const error = new Error(`icon "${iconName}" not found in ${source} (${pack.dir})`);
133
+ error.exitCode = 1;
134
+ throw error;
135
+ }
136
+ const record = pack.map.icons[iconName];
137
+ const pace = PACE[options.pace] || PACE.ui;
138
+ const paceName = PACE[options.pace] ? options.pace : "ui";
139
+ const amplitude = record.amp ?? record.amplitude;
140
+ const parts = record.parts || [];
141
+
142
+ process.stdout.write(`${iconName} - motion map (${path.join(pack.dir, "motion.json")})\n`);
143
+ process.stdout.write(` archetype ${record.archetype} (cue ${record.cue}, domain ${record.domain}, family ${record.family})\n`);
144
+ process.stdout.write(` duration ${Math.round(record.duration * pace.dur)} ms at ${paceName} pace (${record.duration} ms authored), easing ${record.easing}\n`);
145
+ process.stdout.write(` amplitude ${amplitude} ${unitForAxis(record.axis)} (axis ${record.axis}, dir ${record.dir ?? record.direction})\n`);
146
+ process.stdout.write(` parts: ${parts.length}\n`);
147
+ for (let index = 0; index < parts.length; index++) {
148
+ process.stdout.write(partLine(parts[index], index) + "\n");
149
+ }
150
+ if (record.strikeAt !== undefined) {
151
+ process.stdout.write(` strike at ${Math.round(record.strikeAt * pace.dur)} ms (${record.strikeAt} ms authored)\n`);
152
+ }
153
+ if (record.coupling && Array.isArray(record.coupling.followers) && record.coupling.followers.length) {
154
+ const followerText = record.coupling.followers.map((follower) =>
155
+ `part ${follower.part} preset ${follower.preset} stiffness ${follower.stiffness} damping ${follower.damping} gain ${follower.gain}`
156
+ ).join("; ");
157
+ process.stdout.write(` coupling: lead ${record.coupling.lead}, followers: ${followerText}\n`);
158
+ }
159
+ if (record.voice) {
160
+ process.stdout.write(
161
+ ` voice: instrument ${record.voice.instrument}, pitch ${record.voice.pitchSemis} semis, ` +
162
+ `attack ${record.voice.attackMs} ms, decay ${record.voice.decayMs} ms\n`
163
+ );
164
+ }
165
+ const counts = record.treatments || TREATMENTS;
166
+ const countText = counts.map((treatment) => `${treatment}(${(record.partCounts || {})[treatment] ?? "?"})`).join(", ");
167
+ process.stdout.write(` treatments: ${countText}\n`);
168
+ }
169
+
170
+ // audit: check a customised kinetic SVG against the frozen physics bar and against the
171
+ // record its data-icon claims. PASS prints the checked numbers; FAIL lists every
172
+ // violated rule and exits non-zero.
173
+ export async function auditCommand(svgFilePath, options, context) {
174
+ const licenceKey = resolveLicenceKey({ flagKey: options.key, cliDir: context.cliDir });
175
+ const { pack, source, note } = await resolvePack({ packFlag: options.pack, licenceKey });
176
+ printPackNote(note);
177
+
178
+ const resolvedFile = path.resolve(svgFilePath);
179
+ if (!fs.existsSync(resolvedFile)) {
180
+ const error = new Error(`file not found: ${resolvedFile}`);
181
+ error.exitCode = 1;
182
+ throw error;
183
+ }
184
+ const svgText = fs.readFileSync(resolvedFile, "utf8");
185
+
186
+ const iconNameMatch = svgText.match(/data-icon="([^"]*)"/) || svgText.match(/data-name="([^"]*)"/);
187
+ if (!iconNameMatch) {
188
+ const error = new Error(`no data-icon attribute in ${resolvedFile} - audit needs the icon the file belongs to`);
189
+ error.exitCode = 1;
190
+ throw error;
191
+ }
192
+ const iconName = iconNameMatch[1];
193
+ if (!(iconName in pack.map.icons)) {
194
+ const error = new Error(`icon "${iconName}" not found in ${source} (${pack.dir})`);
195
+ error.exitCode = 1;
196
+ throw error;
197
+ }
198
+ const record = pack.map.icons[iconName];
199
+
200
+ const checks = [...checkMotionRecord(record), ...checkSvgFile(svgText, record)];
201
+ process.stdout.write(`audit ${path.basename(resolvedFile)} (icon "${iconName}") against ${path.join(pack.dir, "motion.json")}\n`);
202
+ for (const check of checks) {
203
+ process.stdout.write(` ${check.pass ? "PASS" : "FAIL"} ${check.rule}: ${check.detail}\n`);
204
+ }
205
+ if (record.strikeAt !== undefined) {
206
+ process.stdout.write(" NOTE strike-on-beat: runtime-verified separately - not statically checkable from record + SVG\n");
207
+ }
208
+ const failed = checks.filter((check) => !check.pass);
209
+ if (failed.length) {
210
+ process.stdout.write(`${path.basename(resolvedFile)}: FAIL - ${failed.length} rule(s) violated: ${failed.map((check) => check.rule).join(", ")}\n`);
211
+ process.exitCode = 1;
212
+ } else {
213
+ process.stdout.write(`${path.basename(resolvedFile)}: PASS (${checks.length} rules checked)\n`);
214
+ }
215
+ }