@oriro/orirocli 0.1.7 → 0.1.9

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 (351) hide show
  1. package/ATTRIBUTION.md +8 -0
  2. package/LICENSE +21 -0
  3. package/dist/cli.js +35 -5
  4. package/package.json +1 -1
  5. package/skills/21stdev/SKILL.md +64 -0
  6. package/skills/graphify/SKILL.md +619 -0
  7. package/skills/graphify/__init__.py +28 -0
  8. package/skills/graphify/__main__.py +4582 -0
  9. package/skills/graphify/affected.py +154 -0
  10. package/skills/graphify/always_on/agents-md.md +12 -0
  11. package/skills/graphify/always_on/antigravity-rules.md +14 -0
  12. package/skills/graphify/always_on/claude-md.md +9 -0
  13. package/skills/graphify/always_on/gemini-md.md +9 -0
  14. package/skills/graphify/always_on/kiro-steering.md +5 -0
  15. package/skills/graphify/always_on/vscode-instructions.md +17 -0
  16. package/skills/graphify/analyze.py +724 -0
  17. package/skills/graphify/benchmark.py +155 -0
  18. package/skills/graphify/build.py +487 -0
  19. package/skills/graphify/cache.py +417 -0
  20. package/skills/graphify/callflow_html.py +2020 -0
  21. package/skills/graphify/cluster.py +272 -0
  22. package/skills/graphify/command-kilo.md +15 -0
  23. package/skills/graphify/dedup.py +429 -0
  24. package/skills/graphify/detect.py +1379 -0
  25. package/skills/graphify/diagnostics.py +390 -0
  26. package/skills/graphify/export.py +1408 -0
  27. package/skills/graphify/extract.py +11570 -0
  28. package/skills/graphify/global_graph.py +159 -0
  29. package/skills/graphify/google_workspace.py +223 -0
  30. package/skills/graphify/hooks.py +457 -0
  31. package/skills/graphify/ingest.py +331 -0
  32. package/skills/graphify/llm.py +1896 -0
  33. package/skills/graphify/manifest.py +4 -0
  34. package/skills/graphify/mcp_ingest.py +392 -0
  35. package/skills/graphify/multigraph_compat.py +212 -0
  36. package/skills/graphify/pg_introspect.py +142 -0
  37. package/skills/graphify/prs.py +748 -0
  38. package/skills/graphify/querylog.py +70 -0
  39. package/skills/graphify/report.py +218 -0
  40. package/skills/graphify/scip_ingest.py +363 -0
  41. package/skills/graphify/security.py +336 -0
  42. package/skills/graphify/semantic_cleanup.py +319 -0
  43. package/skills/graphify/serve.py +1309 -0
  44. package/skills/graphify/skill-aider.md +1246 -0
  45. package/skills/graphify/skill-amp.md +613 -0
  46. package/skills/graphify/skill-claw.md +616 -0
  47. package/skills/graphify/skill-codex.md +613 -0
  48. package/skills/graphify/skill-copilot.md +616 -0
  49. package/skills/graphify/skill-devin.md +1372 -0
  50. package/skills/graphify/skill-droid.md +613 -0
  51. package/skills/graphify/skill-kilo.md +625 -0
  52. package/skills/graphify/skill-kiro.md +615 -0
  53. package/skills/graphify/skill-opencode.md +608 -0
  54. package/skills/graphify/skill-pi.md +615 -0
  55. package/skills/graphify/skill-trae.md +614 -0
  56. package/skills/graphify/skill-vscode.md +612 -0
  57. package/skills/graphify/skill-windows.md +651 -0
  58. package/skills/graphify/skills/amp/references/add-watch.md +56 -0
  59. package/skills/graphify/skills/amp/references/exports.md +71 -0
  60. package/skills/graphify/skills/amp/references/extraction-spec.md +68 -0
  61. package/skills/graphify/skills/amp/references/github-and-merge.md +46 -0
  62. package/skills/graphify/skills/amp/references/hooks.md +33 -0
  63. package/skills/graphify/skills/amp/references/query.md +249 -0
  64. package/skills/graphify/skills/amp/references/transcribe.md +48 -0
  65. package/skills/graphify/skills/amp/references/update.md +179 -0
  66. package/skills/graphify/skills/claude/references/add-watch.md +56 -0
  67. package/skills/graphify/skills/claude/references/exports.md +71 -0
  68. package/skills/graphify/skills/claude/references/extraction-spec.md +68 -0
  69. package/skills/graphify/skills/claude/references/github-and-merge.md +46 -0
  70. package/skills/graphify/skills/claude/references/hooks.md +33 -0
  71. package/skills/graphify/skills/claude/references/query.md +103 -0
  72. package/skills/graphify/skills/claude/references/transcribe.md +48 -0
  73. package/skills/graphify/skills/claude/references/update.md +179 -0
  74. package/skills/graphify/skills/claw/references/add-watch.md +56 -0
  75. package/skills/graphify/skills/claw/references/exports.md +71 -0
  76. package/skills/graphify/skills/claw/references/extraction-spec.md +29 -0
  77. package/skills/graphify/skills/claw/references/github-and-merge.md +46 -0
  78. package/skills/graphify/skills/claw/references/hooks.md +33 -0
  79. package/skills/graphify/skills/claw/references/query.md +249 -0
  80. package/skills/graphify/skills/claw/references/transcribe.md +48 -0
  81. package/skills/graphify/skills/claw/references/update.md +179 -0
  82. package/skills/graphify/skills/codex/references/add-watch.md +56 -0
  83. package/skills/graphify/skills/codex/references/exports.md +71 -0
  84. package/skills/graphify/skills/codex/references/extraction-spec.md +29 -0
  85. package/skills/graphify/skills/codex/references/github-and-merge.md +46 -0
  86. package/skills/graphify/skills/codex/references/hooks.md +33 -0
  87. package/skills/graphify/skills/codex/references/query.md +249 -0
  88. package/skills/graphify/skills/codex/references/transcribe.md +48 -0
  89. package/skills/graphify/skills/codex/references/update.md +179 -0
  90. package/skills/graphify/skills/copilot/references/add-watch.md +56 -0
  91. package/skills/graphify/skills/copilot/references/exports.md +71 -0
  92. package/skills/graphify/skills/copilot/references/extraction-spec.md +68 -0
  93. package/skills/graphify/skills/copilot/references/github-and-merge.md +46 -0
  94. package/skills/graphify/skills/copilot/references/hooks.md +33 -0
  95. package/skills/graphify/skills/copilot/references/query.md +249 -0
  96. package/skills/graphify/skills/copilot/references/transcribe.md +48 -0
  97. package/skills/graphify/skills/copilot/references/update.md +179 -0
  98. package/skills/graphify/skills/droid/references/add-watch.md +56 -0
  99. package/skills/graphify/skills/droid/references/exports.md +71 -0
  100. package/skills/graphify/skills/droid/references/extraction-spec.md +68 -0
  101. package/skills/graphify/skills/droid/references/github-and-merge.md +46 -0
  102. package/skills/graphify/skills/droid/references/hooks.md +33 -0
  103. package/skills/graphify/skills/droid/references/query.md +249 -0
  104. package/skills/graphify/skills/droid/references/transcribe.md +48 -0
  105. package/skills/graphify/skills/droid/references/update.md +179 -0
  106. package/skills/graphify/skills/kilo/references/add-watch.md +56 -0
  107. package/skills/graphify/skills/kilo/references/exports.md +71 -0
  108. package/skills/graphify/skills/kilo/references/extraction-spec.md +68 -0
  109. package/skills/graphify/skills/kilo/references/github-and-merge.md +46 -0
  110. package/skills/graphify/skills/kilo/references/hooks.md +33 -0
  111. package/skills/graphify/skills/kilo/references/query.md +249 -0
  112. package/skills/graphify/skills/kilo/references/transcribe.md +48 -0
  113. package/skills/graphify/skills/kilo/references/update.md +179 -0
  114. package/skills/graphify/skills/kiro/references/add-watch.md +56 -0
  115. package/skills/graphify/skills/kiro/references/exports.md +71 -0
  116. package/skills/graphify/skills/kiro/references/extraction-spec.md +29 -0
  117. package/skills/graphify/skills/kiro/references/github-and-merge.md +46 -0
  118. package/skills/graphify/skills/kiro/references/hooks.md +33 -0
  119. package/skills/graphify/skills/kiro/references/query.md +249 -0
  120. package/skills/graphify/skills/kiro/references/transcribe.md +48 -0
  121. package/skills/graphify/skills/kiro/references/update.md +179 -0
  122. package/skills/graphify/skills/opencode/references/add-watch.md +56 -0
  123. package/skills/graphify/skills/opencode/references/exports.md +71 -0
  124. package/skills/graphify/skills/opencode/references/extraction-spec.md +68 -0
  125. package/skills/graphify/skills/opencode/references/github-and-merge.md +46 -0
  126. package/skills/graphify/skills/opencode/references/hooks.md +33 -0
  127. package/skills/graphify/skills/opencode/references/query.md +249 -0
  128. package/skills/graphify/skills/opencode/references/transcribe.md +48 -0
  129. package/skills/graphify/skills/opencode/references/update.md +179 -0
  130. package/skills/graphify/skills/pi/references/add-watch.md +56 -0
  131. package/skills/graphify/skills/pi/references/exports.md +71 -0
  132. package/skills/graphify/skills/pi/references/extraction-spec.md +29 -0
  133. package/skills/graphify/skills/pi/references/github-and-merge.md +46 -0
  134. package/skills/graphify/skills/pi/references/hooks.md +33 -0
  135. package/skills/graphify/skills/pi/references/query.md +249 -0
  136. package/skills/graphify/skills/pi/references/transcribe.md +48 -0
  137. package/skills/graphify/skills/pi/references/update.md +179 -0
  138. package/skills/graphify/skills/trae/references/add-watch.md +56 -0
  139. package/skills/graphify/skills/trae/references/exports.md +71 -0
  140. package/skills/graphify/skills/trae/references/extraction-spec.md +68 -0
  141. package/skills/graphify/skills/trae/references/github-and-merge.md +46 -0
  142. package/skills/graphify/skills/trae/references/hooks.md +35 -0
  143. package/skills/graphify/skills/trae/references/query.md +249 -0
  144. package/skills/graphify/skills/trae/references/transcribe.md +48 -0
  145. package/skills/graphify/skills/trae/references/update.md +179 -0
  146. package/skills/graphify/skills/vscode/references/add-watch.md +56 -0
  147. package/skills/graphify/skills/vscode/references/exports.md +71 -0
  148. package/skills/graphify/skills/vscode/references/extraction-spec.md +68 -0
  149. package/skills/graphify/skills/vscode/references/github-and-merge.md +46 -0
  150. package/skills/graphify/skills/vscode/references/hooks.md +33 -0
  151. package/skills/graphify/skills/vscode/references/query.md +249 -0
  152. package/skills/graphify/skills/vscode/references/transcribe.md +48 -0
  153. package/skills/graphify/skills/vscode/references/update.md +179 -0
  154. package/skills/graphify/skills/windows/references/add-watch.md +56 -0
  155. package/skills/graphify/skills/windows/references/exports.md +71 -0
  156. package/skills/graphify/skills/windows/references/extraction-spec.md +68 -0
  157. package/skills/graphify/skills/windows/references/github-and-merge.md +46 -0
  158. package/skills/graphify/skills/windows/references/hooks.md +33 -0
  159. package/skills/graphify/skills/windows/references/query.md +249 -0
  160. package/skills/graphify/skills/windows/references/transcribe.md +48 -0
  161. package/skills/graphify/skills/windows/references/update.md +179 -0
  162. package/skills/graphify/symbol_resolution.py +538 -0
  163. package/skills/graphify/transcribe.py +184 -0
  164. package/skills/graphify/tree_html.py +582 -0
  165. package/skills/graphify/validate.py +72 -0
  166. package/skills/graphify/watch.py +898 -0
  167. package/skills/graphify/wiki.py +282 -0
  168. package/skills/impeccable/SKILL.md +186 -0
  169. package/skills/impeccable/agents/impeccable_asset_producer.toml +92 -0
  170. package/skills/impeccable/agents/impeccable_manual_edit_applier.toml +95 -0
  171. package/skills/impeccable/agents/openai.yaml +4 -0
  172. package/skills/impeccable/reference/adapt.md +311 -0
  173. package/skills/impeccable/reference/animate.md +201 -0
  174. package/skills/impeccable/reference/audit.md +133 -0
  175. package/skills/impeccable/reference/bolder.md +113 -0
  176. package/skills/impeccable/reference/brand.md +108 -0
  177. package/skills/impeccable/reference/clarify.md +288 -0
  178. package/skills/impeccable/reference/codex.md +105 -0
  179. package/skills/impeccable/reference/colorize.md +257 -0
  180. package/skills/impeccable/reference/craft.md +123 -0
  181. package/skills/impeccable/reference/critique.md +790 -0
  182. package/skills/impeccable/reference/delight.md +302 -0
  183. package/skills/impeccable/reference/distill.md +111 -0
  184. package/skills/impeccable/reference/document.md +429 -0
  185. package/skills/impeccable/reference/extract.md +69 -0
  186. package/skills/impeccable/reference/harden.md +347 -0
  187. package/skills/impeccable/reference/init.md +172 -0
  188. package/skills/impeccable/reference/interaction-design.md +189 -0
  189. package/skills/impeccable/reference/layout.md +161 -0
  190. package/skills/impeccable/reference/live.md +720 -0
  191. package/skills/impeccable/reference/onboard.md +234 -0
  192. package/skills/impeccable/reference/optimize.md +258 -0
  193. package/skills/impeccable/reference/overdrive.md +130 -0
  194. package/skills/impeccable/reference/polish.md +241 -0
  195. package/skills/impeccable/reference/product.md +60 -0
  196. package/skills/impeccable/reference/quieter.md +99 -0
  197. package/skills/impeccable/reference/shape.md +165 -0
  198. package/skills/impeccable/reference/typeset.md +279 -0
  199. package/skills/impeccable/scripts/cleanup-deprecated.mjs +284 -0
  200. package/skills/impeccable/scripts/command-metadata.json +94 -0
  201. package/skills/impeccable/scripts/context-signals.mjs +225 -0
  202. package/skills/impeccable/scripts/context.mjs +266 -0
  203. package/skills/impeccable/scripts/critique-storage.mjs +242 -0
  204. package/skills/impeccable/scripts/design-parser.mjs +835 -0
  205. package/skills/impeccable/scripts/detect-csp.mjs +198 -0
  206. package/skills/impeccable/scripts/detect.mjs +21 -0
  207. package/skills/impeccable/scripts/detector/browser/injected/index.mjs +1733 -0
  208. package/skills/impeccable/scripts/detector/cli/main.mjs +244 -0
  209. package/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +4618 -0
  210. package/skills/impeccable/scripts/detector/detect-antipatterns.mjs +43 -0
  211. package/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +252 -0
  212. package/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +535 -0
  213. package/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +986 -0
  214. package/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +208 -0
  215. package/skills/impeccable/scripts/detector/engines/visual/screenshot-contrast.mjs +189 -0
  216. package/skills/impeccable/scripts/detector/findings.mjs +12 -0
  217. package/skills/impeccable/scripts/detector/node/file-system.mjs +198 -0
  218. package/skills/impeccable/scripts/detector/profile/profiler.mjs +166 -0
  219. package/skills/impeccable/scripts/detector/registry/antipatterns.mjs +419 -0
  220. package/skills/impeccable/scripts/detector/rules/checks.mjs +2384 -0
  221. package/skills/impeccable/scripts/detector/shared/color.mjs +124 -0
  222. package/skills/impeccable/scripts/detector/shared/constants.mjs +101 -0
  223. package/skills/impeccable/scripts/detector/shared/page.mjs +7 -0
  224. package/skills/impeccable/scripts/impeccable-paths.mjs +126 -0
  225. package/skills/impeccable/scripts/is-generated.mjs +69 -0
  226. package/skills/impeccable/scripts/live-accept.mjs +812 -0
  227. package/skills/impeccable/scripts/live-browser-session.js +123 -0
  228. package/skills/impeccable/scripts/live-browser.js +10295 -0
  229. package/skills/impeccable/scripts/live-commit-manual-edits.mjs +1241 -0
  230. package/skills/impeccable/scripts/live-complete.mjs +75 -0
  231. package/skills/impeccable/scripts/live-completion.mjs +19 -0
  232. package/skills/impeccable/scripts/live-copy-edit-agent.mjs +683 -0
  233. package/skills/impeccable/scripts/live-discard-manual-edits.mjs +51 -0
  234. package/skills/impeccable/scripts/live-event-validation.mjs +137 -0
  235. package/skills/impeccable/scripts/live-inject.mjs +557 -0
  236. package/skills/impeccable/scripts/live-insert-ui.mjs +458 -0
  237. package/skills/impeccable/scripts/live-insert.mjs +272 -0
  238. package/skills/impeccable/scripts/live-manual-edit-evidence.mjs +363 -0
  239. package/skills/impeccable/scripts/live-manual-edits-buffer.mjs +152 -0
  240. package/skills/impeccable/scripts/live-poll.mjs +379 -0
  241. package/skills/impeccable/scripts/live-resume.mjs +94 -0
  242. package/skills/impeccable/scripts/live-server.mjs +2326 -0
  243. package/skills/impeccable/scripts/live-session-store.mjs +289 -0
  244. package/skills/impeccable/scripts/live-status.mjs +61 -0
  245. package/skills/impeccable/scripts/live-svelte-component.mjs +826 -0
  246. package/skills/impeccable/scripts/live-sveltekit-adapter.mjs +274 -0
  247. package/skills/impeccable/scripts/live-ui-core.mjs +179 -0
  248. package/skills/impeccable/scripts/live-vocabulary.mjs +36 -0
  249. package/skills/impeccable/scripts/live-wrap.mjs +894 -0
  250. package/skills/impeccable/scripts/live.mjs +246 -0
  251. package/skills/impeccable/scripts/modern-screenshot.umd.js +14 -0
  252. package/skills/impeccable/scripts/palette.mjs +633 -0
  253. package/skills/impeccable/scripts/pin.mjs +214 -0
  254. package/skills/uipm-ui-styling/LICENSE.txt +202 -0
  255. package/skills/uipm-ui-styling/SKILL.md +328 -0
  256. package/skills/uipm-ui-styling/canvas-fonts/ArsenalSC-OFL.txt +93 -0
  257. package/skills/uipm-ui-styling/canvas-fonts/ArsenalSC-Regular.ttf +0 -0
  258. package/skills/uipm-ui-styling/canvas-fonts/BigShoulders-Bold.ttf +0 -0
  259. package/skills/uipm-ui-styling/canvas-fonts/BigShoulders-OFL.txt +93 -0
  260. package/skills/uipm-ui-styling/canvas-fonts/BigShoulders-Regular.ttf +0 -0
  261. package/skills/uipm-ui-styling/canvas-fonts/Boldonse-OFL.txt +93 -0
  262. package/skills/uipm-ui-styling/canvas-fonts/Boldonse-Regular.ttf +0 -0
  263. package/skills/uipm-ui-styling/canvas-fonts/BricolageGrotesque-Bold.ttf +0 -0
  264. package/skills/uipm-ui-styling/canvas-fonts/BricolageGrotesque-OFL.txt +93 -0
  265. package/skills/uipm-ui-styling/canvas-fonts/BricolageGrotesque-Regular.ttf +0 -0
  266. package/skills/uipm-ui-styling/canvas-fonts/CrimsonPro-Bold.ttf +0 -0
  267. package/skills/uipm-ui-styling/canvas-fonts/CrimsonPro-Italic.ttf +0 -0
  268. package/skills/uipm-ui-styling/canvas-fonts/CrimsonPro-OFL.txt +93 -0
  269. package/skills/uipm-ui-styling/canvas-fonts/CrimsonPro-Regular.ttf +0 -0
  270. package/skills/uipm-ui-styling/canvas-fonts/DMMono-OFL.txt +93 -0
  271. package/skills/uipm-ui-styling/canvas-fonts/DMMono-Regular.ttf +0 -0
  272. package/skills/uipm-ui-styling/canvas-fonts/EricaOne-OFL.txt +94 -0
  273. package/skills/uipm-ui-styling/canvas-fonts/EricaOne-Regular.ttf +0 -0
  274. package/skills/uipm-ui-styling/canvas-fonts/GeistMono-Bold.ttf +0 -0
  275. package/skills/uipm-ui-styling/canvas-fonts/GeistMono-OFL.txt +93 -0
  276. package/skills/uipm-ui-styling/canvas-fonts/GeistMono-Regular.ttf +0 -0
  277. package/skills/uipm-ui-styling/canvas-fonts/Gloock-OFL.txt +93 -0
  278. package/skills/uipm-ui-styling/canvas-fonts/Gloock-Regular.ttf +0 -0
  279. package/skills/uipm-ui-styling/canvas-fonts/IBMPlexMono-Bold.ttf +0 -0
  280. package/skills/uipm-ui-styling/canvas-fonts/IBMPlexMono-OFL.txt +93 -0
  281. package/skills/uipm-ui-styling/canvas-fonts/IBMPlexMono-Regular.ttf +0 -0
  282. package/skills/uipm-ui-styling/canvas-fonts/IBMPlexSerif-Bold.ttf +0 -0
  283. package/skills/uipm-ui-styling/canvas-fonts/IBMPlexSerif-BoldItalic.ttf +0 -0
  284. package/skills/uipm-ui-styling/canvas-fonts/IBMPlexSerif-Italic.ttf +0 -0
  285. package/skills/uipm-ui-styling/canvas-fonts/IBMPlexSerif-Regular.ttf +0 -0
  286. package/skills/uipm-ui-styling/canvas-fonts/InstrumentSans-Bold.ttf +0 -0
  287. package/skills/uipm-ui-styling/canvas-fonts/InstrumentSans-BoldItalic.ttf +0 -0
  288. package/skills/uipm-ui-styling/canvas-fonts/InstrumentSans-Italic.ttf +0 -0
  289. package/skills/uipm-ui-styling/canvas-fonts/InstrumentSans-OFL.txt +93 -0
  290. package/skills/uipm-ui-styling/canvas-fonts/InstrumentSans-Regular.ttf +0 -0
  291. package/skills/uipm-ui-styling/canvas-fonts/InstrumentSerif-Italic.ttf +0 -0
  292. package/skills/uipm-ui-styling/canvas-fonts/InstrumentSerif-Regular.ttf +0 -0
  293. package/skills/uipm-ui-styling/canvas-fonts/Italiana-OFL.txt +93 -0
  294. package/skills/uipm-ui-styling/canvas-fonts/Italiana-Regular.ttf +0 -0
  295. package/skills/uipm-ui-styling/canvas-fonts/JetBrainsMono-Bold.ttf +0 -0
  296. package/skills/uipm-ui-styling/canvas-fonts/JetBrainsMono-OFL.txt +93 -0
  297. package/skills/uipm-ui-styling/canvas-fonts/JetBrainsMono-Regular.ttf +0 -0
  298. package/skills/uipm-ui-styling/canvas-fonts/Jura-Light.ttf +0 -0
  299. package/skills/uipm-ui-styling/canvas-fonts/Jura-Medium.ttf +0 -0
  300. package/skills/uipm-ui-styling/canvas-fonts/Jura-OFL.txt +93 -0
  301. package/skills/uipm-ui-styling/canvas-fonts/LibreBaskerville-OFL.txt +93 -0
  302. package/skills/uipm-ui-styling/canvas-fonts/LibreBaskerville-Regular.ttf +0 -0
  303. package/skills/uipm-ui-styling/canvas-fonts/Lora-Bold.ttf +0 -0
  304. package/skills/uipm-ui-styling/canvas-fonts/Lora-BoldItalic.ttf +0 -0
  305. package/skills/uipm-ui-styling/canvas-fonts/Lora-Italic.ttf +0 -0
  306. package/skills/uipm-ui-styling/canvas-fonts/Lora-OFL.txt +93 -0
  307. package/skills/uipm-ui-styling/canvas-fonts/Lora-Regular.ttf +0 -0
  308. package/skills/uipm-ui-styling/canvas-fonts/NationalPark-Bold.ttf +0 -0
  309. package/skills/uipm-ui-styling/canvas-fonts/NationalPark-OFL.txt +93 -0
  310. package/skills/uipm-ui-styling/canvas-fonts/NationalPark-Regular.ttf +0 -0
  311. package/skills/uipm-ui-styling/canvas-fonts/NothingYouCouldDo-OFL.txt +93 -0
  312. package/skills/uipm-ui-styling/canvas-fonts/NothingYouCouldDo-Regular.ttf +0 -0
  313. package/skills/uipm-ui-styling/canvas-fonts/Outfit-Bold.ttf +0 -0
  314. package/skills/uipm-ui-styling/canvas-fonts/Outfit-OFL.txt +93 -0
  315. package/skills/uipm-ui-styling/canvas-fonts/Outfit-Regular.ttf +0 -0
  316. package/skills/uipm-ui-styling/canvas-fonts/PixelifySans-Medium.ttf +0 -0
  317. package/skills/uipm-ui-styling/canvas-fonts/PixelifySans-OFL.txt +93 -0
  318. package/skills/uipm-ui-styling/canvas-fonts/PoiretOne-OFL.txt +93 -0
  319. package/skills/uipm-ui-styling/canvas-fonts/PoiretOne-Regular.ttf +0 -0
  320. package/skills/uipm-ui-styling/canvas-fonts/RedHatMono-Bold.ttf +0 -0
  321. package/skills/uipm-ui-styling/canvas-fonts/RedHatMono-OFL.txt +93 -0
  322. package/skills/uipm-ui-styling/canvas-fonts/RedHatMono-Regular.ttf +0 -0
  323. package/skills/uipm-ui-styling/canvas-fonts/Silkscreen-OFL.txt +93 -0
  324. package/skills/uipm-ui-styling/canvas-fonts/Silkscreen-Regular.ttf +0 -0
  325. package/skills/uipm-ui-styling/canvas-fonts/SmoochSans-Medium.ttf +0 -0
  326. package/skills/uipm-ui-styling/canvas-fonts/SmoochSans-OFL.txt +93 -0
  327. package/skills/uipm-ui-styling/canvas-fonts/Tektur-Medium.ttf +0 -0
  328. package/skills/uipm-ui-styling/canvas-fonts/Tektur-OFL.txt +93 -0
  329. package/skills/uipm-ui-styling/canvas-fonts/Tektur-Regular.ttf +0 -0
  330. package/skills/uipm-ui-styling/canvas-fonts/WorkSans-Bold.ttf +0 -0
  331. package/skills/uipm-ui-styling/canvas-fonts/WorkSans-BoldItalic.ttf +0 -0
  332. package/skills/uipm-ui-styling/canvas-fonts/WorkSans-Italic.ttf +0 -0
  333. package/skills/uipm-ui-styling/canvas-fonts/WorkSans-OFL.txt +93 -0
  334. package/skills/uipm-ui-styling/canvas-fonts/WorkSans-Regular.ttf +0 -0
  335. package/skills/uipm-ui-styling/canvas-fonts/YoungSerif-OFL.txt +93 -0
  336. package/skills/uipm-ui-styling/canvas-fonts/YoungSerif-Regular.ttf +0 -0
  337. package/skills/uipm-ui-styling/references/canvas-design-system.md +320 -0
  338. package/skills/uipm-ui-styling/references/shadcn-accessibility.md +471 -0
  339. package/skills/uipm-ui-styling/references/shadcn-components.md +424 -0
  340. package/skills/uipm-ui-styling/references/shadcn-theming.md +373 -0
  341. package/skills/uipm-ui-styling/references/tailwind-customization.md +483 -0
  342. package/skills/uipm-ui-styling/references/tailwind-responsive.md +382 -0
  343. package/skills/uipm-ui-styling/references/tailwind-utilities.md +455 -0
  344. package/skills/uipm-ui-styling/scripts/.coverage +0 -0
  345. package/skills/uipm-ui-styling/scripts/requirements.txt +17 -0
  346. package/skills/uipm-ui-styling/scripts/shadcn_add.py +292 -0
  347. package/skills/uipm-ui-styling/scripts/tailwind_config_gen.py +456 -0
  348. package/skills/uipm-ui-styling/scripts/tests/coverage-ui.json +1 -0
  349. package/skills/uipm-ui-styling/scripts/tests/requirements.txt +3 -0
  350. package/skills/uipm-ui-styling/scripts/tests/test_shadcn_add.py +266 -0
  351. package/skills/uipm-ui-styling/scripts/tests/test_tailwind_config_gen.py +336 -0
@@ -0,0 +1,272 @@
1
+ /**
2
+ * CLI helper: find an anchor element in source and splice an insert-variant
3
+ * wrapper before or after it (no original variant — net-new content).
4
+ *
5
+ * Usage:
6
+ * node live-insert.mjs --id SESSION_ID --count N --position after \
7
+ * --classes "hero" --tag section [--file path]
8
+ */
9
+
10
+ import fs from 'node:fs';
11
+ import path from 'node:path';
12
+ import { isGeneratedFile } from './is-generated.mjs';
13
+ import {
14
+ buildSearchQueries,
15
+ findElement,
16
+ findAllElements,
17
+ filterByText,
18
+ findFileWithQuery,
19
+ detectCommentSyntax,
20
+ detectStyleMode,
21
+ buildCssAuthoring,
22
+ buildCssSelectorPrefixExamples,
23
+ } from './live-wrap.mjs';
24
+ import {
25
+ buildSvelteComponentCssAuthoring,
26
+ scaffoldSvelteComponentInsertSession,
27
+ shouldUseSvelteComponentInjection,
28
+ } from './live-svelte-component.mjs';
29
+
30
+ const INSERT_POSITIONS = new Set(['before', 'after']);
31
+
32
+ export function isInsertPosition(value) {
33
+ return INSERT_POSITIONS.has(value);
34
+ }
35
+
36
+ export function computeInsertLine(startLine, endLine, position) {
37
+ return position === 'before' ? startLine : endLine + 1;
38
+ }
39
+
40
+ export function buildInsertWrapperLines({ id, count, indent, commentSyntax, isJsx }) {
41
+ const styleContents = isJsx ? 'style={{ display: "contents" }}' : 'style="display: contents"';
42
+ const attrs =
43
+ 'data-impeccable-variants="' + id + '" ' +
44
+ 'data-impeccable-mode="insert" ' +
45
+ 'data-impeccable-variant-count="' + count + '" ' +
46
+ styleContents;
47
+
48
+ if (isJsx) {
49
+ return [
50
+ indent + '<div ' + attrs + '>',
51
+ indent + ' ' + commentSyntax.open + ' impeccable-variants-start ' + id + ' ' + commentSyntax.close,
52
+ indent + ' ' + commentSyntax.open + ' Variants: insert below this line ' + commentSyntax.close,
53
+ indent + ' ' + commentSyntax.open + ' impeccable-variants-end ' + id + ' ' + commentSyntax.close,
54
+ indent + '</div>',
55
+ ];
56
+ }
57
+
58
+ return [
59
+ indent + commentSyntax.open + ' impeccable-variants-start ' + id + ' ' + commentSyntax.close,
60
+ indent + '<div ' + attrs + '>',
61
+ indent + ' ' + commentSyntax.open + ' Variants: insert below this line ' + commentSyntax.close,
62
+ indent + '</div>',
63
+ indent + commentSyntax.open + ' impeccable-variants-end ' + id + ' ' + commentSyntax.close,
64
+ ];
65
+ }
66
+
67
+ function argVal(args, flag) {
68
+ const idx = args.indexOf(flag);
69
+ return idx !== -1 && idx + 1 < args.length ? args[idx + 1] : null;
70
+ }
71
+
72
+ function resolveElementMatch({ lines, queries, tag, text }) {
73
+ if (text) {
74
+ const candidates = [];
75
+ for (const q of queries) {
76
+ const all = findAllElements(lines, q, tag);
77
+ for (const c of all) {
78
+ if (!candidates.some((x) => x.startLine === c.startLine)) candidates.push(c);
79
+ }
80
+ if (candidates.length === 1) break;
81
+ }
82
+ if (candidates.length === 0) return { error: 'element_not_found' };
83
+ if (candidates.length === 1) return { match: candidates[0] };
84
+ const filtered = filterByText(candidates, lines, text);
85
+ if (filtered.length === 1) return { match: filtered[0] };
86
+ if (filtered.length === 0) return { match: candidates[0] };
87
+ return { error: 'element_ambiguous', candidates: filtered };
88
+ }
89
+
90
+ for (const q of queries) {
91
+ const match = findElement(lines, q, tag);
92
+ if (match) return { match };
93
+ }
94
+ return { error: 'element_not_found' };
95
+ }
96
+
97
+ export async function insertCli() {
98
+ const args = process.argv.slice(2);
99
+
100
+ if (args.includes('--help') || args.includes('-h')) {
101
+ console.log(`Usage: node live-insert.mjs [options]
102
+
103
+ Find an anchor element in source and splice an insert-variant wrapper.
104
+
105
+ Required:
106
+ --id ID Session ID for the variant wrapper
107
+ --count N Number of expected variants (1-8)
108
+ --position POS before | after (relative to the anchor element)
109
+
110
+ Element identification (at least one required):
111
+ --element-id ID HTML id attribute of the anchor element
112
+ --classes A,B,C Comma-separated CSS class names
113
+ --tag TAG Tag name (div, section, etc.)
114
+ --query TEXT Fallback: raw text to search for
115
+
116
+ Optional:
117
+ --file PATH Source file to search in (skips auto-detection)
118
+ --text TEXT Anchor textContent for disambiguation (~80 chars)
119
+
120
+ Output (JSON):
121
+ { mode: "insert", file, position, insertLine, commentSyntax, styleMode, styleTag, cssAuthoring }`);
122
+ process.exit(0);
123
+ }
124
+
125
+ const id = argVal(args, '--id');
126
+ const count = parseInt(argVal(args, '--count') || '3', 10);
127
+ const position = argVal(args, '--position');
128
+ const elementId = argVal(args, '--element-id');
129
+ const classes = argVal(args, '--classes');
130
+ const tag = argVal(args, '--tag');
131
+ const query = argVal(args, '--query');
132
+ const filePath = argVal(args, '--file');
133
+ const text = argVal(args, '--text');
134
+
135
+ if (!id) { console.error('Missing --id'); process.exit(1); }
136
+ if (!position) { console.error('Missing --position (before | after)'); process.exit(1); }
137
+ if (!isInsertPosition(position)) { console.error('Invalid --position: ' + position); process.exit(1); }
138
+ if (!elementId && !classes && !query) {
139
+ console.error('Need at least one of: --element-id, --classes, --query');
140
+ process.exit(1);
141
+ }
142
+
143
+ const queries = buildSearchQueries(elementId, classes, tag, query);
144
+ const genOpts = { cwd: process.cwd() };
145
+
146
+ let targetFile = filePath;
147
+ if (!targetFile) {
148
+ for (const q of queries) {
149
+ targetFile = findFileWithQuery(q, process.cwd(), genOpts);
150
+ if (targetFile) break;
151
+ }
152
+ if (!targetFile) {
153
+ let generatedHit = null;
154
+ for (const q of queries) {
155
+ generatedHit = findFileWithQuery(q, process.cwd(), { ...genOpts, includeGenerated: true });
156
+ if (generatedHit) break;
157
+ }
158
+ console.error(JSON.stringify({
159
+ error: generatedHit ? 'element_not_in_source' : 'element_not_found',
160
+ fallback: 'agent-driven',
161
+ hint: 'See "Handle fallback" in live.md.',
162
+ }));
163
+ process.exit(1);
164
+ }
165
+ } else if (isGeneratedFile(targetFile, genOpts)) {
166
+ console.error(JSON.stringify({
167
+ error: 'file_is_generated',
168
+ fallback: 'agent-driven',
169
+ file: path.relative(process.cwd(), path.resolve(process.cwd(), targetFile)),
170
+ }));
171
+ process.exit(1);
172
+ }
173
+
174
+ const content = fs.readFileSync(targetFile, 'utf-8');
175
+ const lines = content.split('\n');
176
+ const resolved = resolveElementMatch({ lines, queries, tag, text });
177
+
178
+ if (resolved.error === 'element_ambiguous') {
179
+ console.error(JSON.stringify({
180
+ error: 'element_ambiguous',
181
+ fallback: 'agent-driven',
182
+ file: path.relative(process.cwd(), targetFile),
183
+ candidates: resolved.candidates.map((c) => ({
184
+ startLine: c.startLine + 1,
185
+ endLine: c.endLine + 1,
186
+ })),
187
+ }));
188
+ process.exit(1);
189
+ }
190
+ if (!resolved.match) {
191
+ console.error(JSON.stringify({ error: 'element_not_found', fallback: 'agent-driven' }));
192
+ process.exit(1);
193
+ }
194
+
195
+ const { startLine, endLine } = resolved.match;
196
+ const commentSyntax = detectCommentSyntax(targetFile);
197
+ const styleMode = detectStyleMode(targetFile);
198
+ const isJsx = commentSyntax.open === '{/*';
199
+ const spliceIndex = computeInsertLine(startLine, endLine, position);
200
+ const relTargetFile = path.relative(process.cwd(), targetFile).split(path.sep).join('/');
201
+
202
+ if (shouldUseSvelteComponentInjection(targetFile)) {
203
+ const session = scaffoldSvelteComponentInsertSession({
204
+ id,
205
+ count,
206
+ sourceFile: relTargetFile,
207
+ insertLine: spliceIndex + 1,
208
+ position,
209
+ anchorStartLine: startLine + 1,
210
+ anchorEndLine: endLine + 1,
211
+ anchorLines: lines.slice(startLine, endLine + 1),
212
+ cwd: process.cwd(),
213
+ });
214
+ console.log(JSON.stringify({
215
+ mode: 'insert',
216
+ position,
217
+ file: session.manifestFile,
218
+ sourceFile: relTargetFile,
219
+ previewMode: 'svelte-component',
220
+ componentDir: session.componentDir,
221
+ propContract: session.propContract,
222
+ insertLine: 1,
223
+ sourceInsertLine: spliceIndex + 1,
224
+ anchorStartLine: startLine + 1,
225
+ anchorEndLine: endLine + 1,
226
+ commentSyntax,
227
+ styleMode: 'svelte-component',
228
+ styleTag: null,
229
+ cssSelectorPrefixExamples: [],
230
+ cssAuthoring: buildSvelteComponentCssAuthoring(count),
231
+ }));
232
+ return;
233
+ }
234
+
235
+ const indent = lines[spliceIndex]?.match(/^(\s*)/)?.[1]
236
+ ?? lines[startLine]?.match(/^(\s*)/)?.[1]
237
+ ?? '';
238
+
239
+ const wrapperLines = buildInsertWrapperLines({
240
+ id,
241
+ count,
242
+ indent,
243
+ commentSyntax,
244
+ isJsx,
245
+ });
246
+
247
+ const newLines = [
248
+ ...lines.slice(0, spliceIndex),
249
+ ...wrapperLines,
250
+ ...lines.slice(spliceIndex),
251
+ ];
252
+ fs.writeFileSync(targetFile, newLines.join('\n'), 'utf-8');
253
+
254
+ const insertLine = spliceIndex + 3;
255
+
256
+ console.log(JSON.stringify({
257
+ mode: 'insert',
258
+ position,
259
+ file: relTargetFile,
260
+ insertLine: insertLine + 1,
261
+ commentSyntax,
262
+ styleMode: styleMode.mode,
263
+ styleTag: styleMode.styleTag,
264
+ cssSelectorPrefixExamples: buildCssSelectorPrefixExamples(styleMode.mode, count),
265
+ cssAuthoring: buildCssAuthoring(styleMode, count),
266
+ }));
267
+ }
268
+
269
+ const _running = process.argv[1];
270
+ if (_running?.endsWith('live-insert.mjs') || _running?.endsWith('live-insert.mjs/')) {
271
+ insertCli();
272
+ }
@@ -0,0 +1,363 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Collect evidence for pending live copy edits.
4
+ *
5
+ * This module intentionally does not edit source files and does not choose a
6
+ * winner. It gathers staged browser edits, rendered context, framework source
7
+ * hints, and likely source candidates so the AI copy-edit batch runner can make
8
+ * source changes with full repo context.
9
+ */
10
+
11
+ import fs from 'node:fs';
12
+ import path from 'node:path';
13
+ import { isGeneratedFile } from './is-generated.mjs';
14
+ import { readBuffer, getBufferPath } from './live-manual-edits-buffer.mjs';
15
+
16
+ const EVIDENCE_VERSION = 1;
17
+ const TEXT_EXTENSIONS = new Set(['.html', '.jsx', '.tsx', '.vue', '.svelte', '.astro', '.js', '.mjs', '.ts']);
18
+ const SEARCH_DIRS = ['src', 'app', 'pages', 'components', 'public', 'views', 'templates', 'site', 'lib', 'data'];
19
+ const STRONG_LITERAL_MATCH_LIMIT = 8;
20
+ const WEAK_LITERAL_MATCH_LIMIT = 4;
21
+ const OBJECT_KEY_MATCH_LIMIT = 8;
22
+ const LOCATOR_MATCH_LIMIT = 4;
23
+ const CONTEXT_MATCH_LIMIT = 8;
24
+ const CONTEXT_MATCH_PER_HINT = 2;
25
+ const SKIP_DIRS = new Set([
26
+ 'node_modules',
27
+ '.git',
28
+ '.impeccable',
29
+ '.astro',
30
+ '.next',
31
+ '.nuxt',
32
+ '.svelte-kit',
33
+ 'dist',
34
+ 'build',
35
+ 'out',
36
+ 'coverage',
37
+ ]);
38
+
39
+ export function buildManualEditEvidence({ cwd = process.cwd(), pageUrl = null } = {}) {
40
+ const buffer = readBuffer(cwd);
41
+ const entries = pageUrl
42
+ ? buffer.entries.filter((entry) => entry.pageUrl === pageUrl)
43
+ : buffer.entries;
44
+ const opCount = countOps(entries);
45
+
46
+ if (opCount === 0) {
47
+ return {
48
+ pageUrl,
49
+ count: 0,
50
+ entries: [],
51
+ ops: [],
52
+ candidates: [],
53
+ };
54
+ }
55
+
56
+ const searchFiles = collectSearchFiles(cwd);
57
+ const ops = flattenOps(entries);
58
+ const candidates = ops.map((op) => buildCandidatesForOp(op, cwd, searchFiles));
59
+ return {
60
+ version: EVIDENCE_VERSION,
61
+ pageUrl: pageUrl || null,
62
+ count: opCount,
63
+ entries,
64
+ ops,
65
+ context: {
66
+ cwd,
67
+ bufferPath: path.relative(cwd, getBufferPath(cwd)),
68
+ totalEntries: entries.length,
69
+ totalOps: opCount,
70
+ },
71
+ candidates,
72
+ };
73
+ }
74
+
75
+ function countOps(entries) {
76
+ let count = 0;
77
+ for (const entry of entries) count += Array.isArray(entry.ops) ? entry.ops.length : 0;
78
+ return count;
79
+ }
80
+
81
+ function flattenOps(entries) {
82
+ const out = [];
83
+ for (const entry of entries) {
84
+ const contextHintsByRef = buildContextHintsByRef(entry);
85
+ for (const op of entry.ops || []) {
86
+ out.push({
87
+ entryId: entry.id,
88
+ pageUrl: entry.pageUrl,
89
+ ref: op.ref,
90
+ contextRef: op.contextRef || null,
91
+ tag: op.tag,
92
+ elementId: op.elementId || null,
93
+ classes: Array.isArray(op.classes) ? op.classes : [],
94
+ originalText: op.originalText,
95
+ newText: op.newText,
96
+ deleted: op.deleted === true,
97
+ sourceHint: op.sourceHint || null,
98
+ leaf: op.leaf || null,
99
+ nearbyEditableTexts: Array.isArray(op.nearbyEditableTexts) ? op.nearbyEditableTexts : [],
100
+ container: op.container || null,
101
+ contextHints: contextHintsByRef.get(op.ref) || [],
102
+ });
103
+ }
104
+ }
105
+ return out;
106
+ }
107
+
108
+ function buildContextHintsByRef(entry) {
109
+ const map = new Map();
110
+ for (const op of entry.ops || []) {
111
+ const hints = new Set();
112
+ const add = (value) => {
113
+ const text = normalizeText(decodeBasicHtml(String(value || '')));
114
+ if (text.length < 3 || text.length > 160) return;
115
+ if (text === normalizeText(op.originalText) || text === normalizeText(op.newText)) return;
116
+ hints.add(text);
117
+ };
118
+
119
+ for (const item of op.nearbyEditableTexts || []) {
120
+ add(typeof item === 'string' ? item : item?.text);
121
+ }
122
+ const outer = typeof entry.element?.outerHTML === 'string' ? entry.element.outerHTML : '';
123
+ for (const match of outer.matchAll(/data-impeccable-original-text="([^"]*)"/g)) add(match[1]);
124
+ if (typeof entry.element?.textContent === 'string') {
125
+ for (const chunk of entry.element.textContent.split(/\s{2,}|\n|\t/)) add(chunk);
126
+ }
127
+ map.set(op.ref, [...hints].slice(0, 16));
128
+ }
129
+ return map;
130
+ }
131
+
132
+ function buildCandidatesForOp(op, cwd, searchFiles) {
133
+ const originalText = String(op.originalText || '');
134
+ const contextNeedles = op.contextHints || [];
135
+ return {
136
+ entryId: op.entryId,
137
+ ref: op.ref,
138
+ originalText,
139
+ sourceHint: analyzeSourceHint(op, cwd),
140
+ textMatches: originalText ? findLiteralMatches(searchFiles, originalText, { max: literalMatchLimit(originalText) }) : [],
141
+ objectKeyMatches: originalText ? findObjectKeyMatches(searchFiles, originalText, { max: OBJECT_KEY_MATCH_LIMIT }) : [],
142
+ locatorMatches: findLocatorMatches(searchFiles, op, { max: LOCATOR_MATCH_LIMIT }),
143
+ contextTextMatches: findContextMatches(searchFiles, contextNeedles, { maxPerHint: CONTEXT_MATCH_PER_HINT, max: CONTEXT_MATCH_LIMIT }),
144
+ };
145
+ }
146
+
147
+ function literalMatchLimit(text) {
148
+ return isWeakSourceNeedle(text) ? WEAK_LITERAL_MATCH_LIMIT : STRONG_LITERAL_MATCH_LIMIT;
149
+ }
150
+
151
+ function isWeakSourceNeedle(text) {
152
+ const normalized = normalizeText(text);
153
+ return normalized.length < 4 || /^[\d.,+\-%\s]+$/.test(normalized);
154
+ }
155
+
156
+ function analyzeSourceHint(op, cwd) {
157
+ const hint = normalizeSourceHint(op.sourceHint);
158
+ if (!hint.file) return null;
159
+ const file = path.resolve(cwd, hint.file);
160
+ const relativeFile = path.relative(cwd, file);
161
+ if (!isPathInsideOrEqual(cwd, file)) {
162
+ return { ...hint, status: 'outside_cwd', relativeFile: hint.file };
163
+ }
164
+ if (!fs.existsSync(file)) {
165
+ return { ...hint, status: 'file_missing', relativeFile };
166
+ }
167
+ if (isGeneratedFile(file, { cwd })) {
168
+ return { ...hint, status: 'generated', relativeFile };
169
+ }
170
+
171
+ const content = fs.readFileSync(file, 'utf-8');
172
+ const lines = content.split('\n');
173
+ const line = hint.line || 1;
174
+ const start = Math.max(0, line - 4);
175
+ const end = Math.min(lines.length, line + 3);
176
+ const windowText = lines.slice(start, end).join('\n');
177
+ const containsOriginalText = typeof op.originalText === 'string' && windowText.includes(op.originalText);
178
+ return {
179
+ ...hint,
180
+ status: containsOriginalText ? 'ok' : 'text_not_found_near_hint',
181
+ relativeFile,
182
+ excerpt: lines.slice(start, end).map((text, index) => ({
183
+ line: start + index + 1,
184
+ text: text.slice(0, 240),
185
+ })),
186
+ };
187
+ }
188
+
189
+ function normalizeSourceHint(hint) {
190
+ if (!hint || typeof hint !== 'object') return {};
191
+ let line = Number.isFinite(Number(hint.line)) ? Number(hint.line) : null;
192
+ let column = Number.isFinite(Number(hint.column)) ? Number(hint.column) : null;
193
+ if ((!line || !column) && typeof hint.loc === 'string') {
194
+ const match = hint.loc.match(/^(\d+)(?::(\d+))?/);
195
+ if (match) {
196
+ line = Number(match[1]);
197
+ if (match[2]) column = Number(match[2]);
198
+ }
199
+ }
200
+ return {
201
+ file: typeof hint.file === 'string' ? hint.file : '',
202
+ loc: typeof hint.loc === 'string' ? hint.loc : '',
203
+ line,
204
+ column,
205
+ };
206
+ }
207
+
208
+ function collectSearchFiles(cwd) {
209
+ const out = [];
210
+ const seenDirs = new Set();
211
+ const seenFiles = new Set();
212
+ for (const dir of SEARCH_DIRS) {
213
+ scanDir(path.join(cwd, dir), cwd, seenDirs, seenFiles, out, 0);
214
+ }
215
+ scanRootFiles(cwd, seenFiles, out);
216
+ return out;
217
+ }
218
+
219
+ function scanDir(dir, cwd, seenDirs, seenFiles, out, depth) {
220
+ if (depth > 7 || !fs.existsSync(dir)) return;
221
+ let realDir;
222
+ try { realDir = fs.realpathSync(dir); } catch { return; }
223
+ if (seenDirs.has(realDir)) return;
224
+ seenDirs.add(realDir);
225
+
226
+ let entries;
227
+ try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return; }
228
+ for (const entry of entries) {
229
+ const fullPath = path.join(dir, entry.name);
230
+ if (entry.isDirectory()) {
231
+ if (SKIP_DIRS.has(entry.name)) continue;
232
+ scanDir(fullPath, cwd, seenDirs, seenFiles, out, depth + 1);
233
+ continue;
234
+ }
235
+ if (!entry.isFile() || !TEXT_EXTENSIONS.has(path.extname(entry.name).toLowerCase())) continue;
236
+ maybeAddSearchFile(fullPath, cwd, seenFiles, out);
237
+ }
238
+ }
239
+
240
+ function scanRootFiles(cwd, seenFiles, out) {
241
+ let entries;
242
+ try { entries = fs.readdirSync(cwd, { withFileTypes: true }); } catch { return; }
243
+ for (const entry of entries) {
244
+ if (!entry.isFile() || !TEXT_EXTENSIONS.has(path.extname(entry.name).toLowerCase())) continue;
245
+ maybeAddSearchFile(path.join(cwd, entry.name), cwd, seenFiles, out);
246
+ }
247
+ }
248
+
249
+ function maybeAddSearchFile(file, cwd, seenFiles, out) {
250
+ let realFile;
251
+ try { realFile = fs.realpathSync(file); } catch { return; }
252
+ if (seenFiles.has(realFile)) return;
253
+ seenFiles.add(realFile);
254
+ if (isGeneratedFile(file, { cwd })) return;
255
+ let content;
256
+ try { content = fs.readFileSync(file, 'utf-8'); } catch { return; }
257
+ out.push({ file, relativeFile: path.relative(cwd, file), content, lines: content.split('\n') });
258
+ }
259
+
260
+ function findLiteralMatches(searchFiles, needle, { max }) {
261
+ return findMatches(searchFiles, needle, { kind: 'text', max });
262
+ }
263
+
264
+ function findObjectKeyMatches(searchFiles, text, { max }) {
265
+ const re = new RegExp('(["\\\'`])' + escapeRegExp(text) + '\\1(?=\\s*:)', 'g');
266
+ const out = [];
267
+ for (const file of searchFiles) {
268
+ for (const match of file.content.matchAll(re)) {
269
+ out.push(matchForIndex(file, match.index, 'object_key', text));
270
+ if (out.length >= max) return out;
271
+ }
272
+ }
273
+ return out;
274
+ }
275
+
276
+ function findLocatorMatches(searchFiles, op, { max }) {
277
+ const needles = [];
278
+ if (op.elementId) needles.push({ kind: 'id', needle: op.elementId });
279
+ for (const cls of op.classes || []) {
280
+ if (cls) needles.push({ kind: 'class', needle: cls });
281
+ }
282
+ if (op.tag) needles.push({ kind: 'tag', needle: '<' + op.tag });
283
+
284
+ const out = [];
285
+ const seen = new Set();
286
+ for (const { kind, needle } of needles) {
287
+ for (const match of findMatches(searchFiles, needle, { kind, max })) {
288
+ const key = match.file + ':' + match.line + ':' + kind + ':' + needle;
289
+ if (seen.has(key)) continue;
290
+ seen.add(key);
291
+ out.push({ ...match, needle });
292
+ if (out.length >= max) return out;
293
+ }
294
+ }
295
+ return out;
296
+ }
297
+
298
+ function findContextMatches(searchFiles, hints, { maxPerHint, max }) {
299
+ const out = [];
300
+ const seen = new Set();
301
+ for (const hint of hints || []) {
302
+ for (const match of findMatches(searchFiles, hint, { kind: 'context', max: maxPerHint })) {
303
+ const key = match.file + ':' + match.line + ':' + hint;
304
+ if (seen.has(key)) continue;
305
+ seen.add(key);
306
+ out.push({ ...match, needle: hint });
307
+ if (out.length >= max) return out;
308
+ }
309
+ }
310
+ return out;
311
+ }
312
+
313
+ function findMatches(searchFiles, needle, { kind, max }) {
314
+ const text = String(needle || '');
315
+ if (!text) return [];
316
+ const out = [];
317
+ for (const file of searchFiles) {
318
+ let index = 0;
319
+ while (out.length < max) {
320
+ index = file.content.indexOf(text, index);
321
+ if (index === -1) break;
322
+ out.push(matchForIndex(file, index, kind, text));
323
+ index += Math.max(1, text.length);
324
+ }
325
+ if (out.length >= max) break;
326
+ }
327
+ return out;
328
+ }
329
+
330
+ function matchForIndex(file, index, kind, needle) {
331
+ const line = file.content.slice(0, index).split('\n').length;
332
+ const lineText = file.lines[line - 1] || '';
333
+ return {
334
+ kind,
335
+ file: file.relativeFile,
336
+ line,
337
+ needle,
338
+ excerpt: lineText.trim().slice(0, 240),
339
+ };
340
+ }
341
+
342
+ function isPathInsideOrEqual(cwd, file) {
343
+ const rel = path.relative(path.resolve(cwd), path.resolve(file));
344
+ return rel === '' || (!rel.startsWith('..') && !path.isAbsolute(rel));
345
+ }
346
+
347
+ function normalizeText(value) {
348
+ return String(value || '').replace(/\s+/g, ' ').trim();
349
+ }
350
+
351
+ function decodeBasicHtml(value) {
352
+ return value
353
+ .replace(/&quot;/g, '"')
354
+ .replace(/&#39;/g, "'")
355
+ .replace(/&apos;/g, "'")
356
+ .replace(/&amp;/g, '&')
357
+ .replace(/&lt;/g, '<')
358
+ .replace(/&gt;/g, '>');
359
+ }
360
+
361
+ function escapeRegExp(value) {
362
+ return String(value).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
363
+ }