@dev-sergeev/datalab-kit 0.1.2 → 0.1.4

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 (355) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +23 -5
  3. package/THIRD_PARTY_NOTICES.md +6 -2
  4. package/docs/adr/0001-user-settings-priority.md +2 -0
  5. package/docs/adr/0002-package-delivery.md +8 -0
  6. package/node_modules/@pi-plugins/elapsed/LICENSE +21 -0
  7. package/node_modules/@pi-plugins/elapsed/README.md +45 -0
  8. package/node_modules/@pi-plugins/elapsed/dist/index.d.mts +8 -0
  9. package/node_modules/@pi-plugins/elapsed/dist/index.d.mts.map +1 -0
  10. package/node_modules/@pi-plugins/elapsed/dist/index.mjs +47 -0
  11. package/node_modules/@pi-plugins/elapsed/dist/index.mjs.map +1 -0
  12. package/node_modules/@pi-plugins/elapsed/package.json +65 -0
  13. package/node_modules/@tifan/pi-recap/README.md +61 -0
  14. package/node_modules/@tifan/pi-recap/package.json +43 -0
  15. package/node_modules/@tifan/pi-recap/src/index.ts +586 -0
  16. package/node_modules/@tifan/pi-recap/src/model-picker.ts +234 -0
  17. package/node_modules/@tifan/pi-recap/src/models.ts +180 -0
  18. package/node_modules/@tifan/pi-recap/src/sanitize.ts +119 -0
  19. package/node_modules/@tifan/pi-recap/src/tui.ts +155 -0
  20. package/node_modules/@zigai/pi-extension-internals/README.md +24 -0
  21. package/node_modules/@zigai/pi-extension-internals/dist/editor-enhancer-registry.d.ts +21 -0
  22. package/node_modules/@zigai/pi-extension-internals/dist/editor-enhancer-registry.js +233 -0
  23. package/node_modules/@zigai/pi-extension-internals/dist/index.d.ts +6 -0
  24. package/node_modules/@zigai/pi-extension-internals/dist/index.js +3 -0
  25. package/node_modules/@zigai/pi-extension-internals/dist/linked-method-patch.d.ts +34 -0
  26. package/node_modules/@zigai/pi-extension-internals/dist/linked-method-patch.js +272 -0
  27. package/node_modules/@zigai/pi-extension-internals/dist/pi-internal-import.d.ts +11 -0
  28. package/node_modules/@zigai/pi-extension-internals/dist/pi-internal-import.js +139 -0
  29. package/node_modules/@zigai/pi-extension-internals/package.json +41 -0
  30. package/node_modules/@zigai/pi-extension-settings/LICENSE +21 -0
  31. package/node_modules/@zigai/pi-extension-settings/README.md +36 -0
  32. package/node_modules/@zigai/pi-extension-settings/dist/artifacts.d.ts +23 -0
  33. package/node_modules/@zigai/pi-extension-settings/dist/artifacts.d.ts.map +1 -0
  34. package/node_modules/@zigai/pi-extension-settings/dist/artifacts.js +75 -0
  35. package/node_modules/@zigai/pi-extension-settings/dist/artifacts.js.map +1 -0
  36. package/node_modules/@zigai/pi-extension-settings/dist/cli-entry.d.ts +3 -0
  37. package/node_modules/@zigai/pi-extension-settings/dist/cli-entry.d.ts.map +1 -0
  38. package/node_modules/@zigai/pi-extension-settings/dist/cli-entry.js +5 -0
  39. package/node_modules/@zigai/pi-extension-settings/dist/cli-entry.js.map +1 -0
  40. package/node_modules/@zigai/pi-extension-settings/dist/cli.d.ts +6 -0
  41. package/node_modules/@zigai/pi-extension-settings/dist/cli.d.ts.map +1 -0
  42. package/node_modules/@zigai/pi-extension-settings/dist/cli.js +87 -0
  43. package/node_modules/@zigai/pi-extension-settings/dist/cli.js.map +1 -0
  44. package/node_modules/@zigai/pi-extension-settings/dist/definition-marker.d.ts +2 -0
  45. package/node_modules/@zigai/pi-extension-settings/dist/definition-marker.d.ts.map +1 -0
  46. package/node_modules/@zigai/pi-extension-settings/dist/definition-marker.js +2 -0
  47. package/node_modules/@zigai/pi-extension-settings/dist/definition-marker.js.map +1 -0
  48. package/node_modules/@zigai/pi-extension-settings/dist/definition.d.ts +159 -0
  49. package/node_modules/@zigai/pi-extension-settings/dist/definition.d.ts.map +1 -0
  50. package/node_modules/@zigai/pi-extension-settings/dist/definition.js +248 -0
  51. package/node_modules/@zigai/pi-extension-settings/dist/definition.js.map +1 -0
  52. package/node_modules/@zigai/pi-extension-settings/dist/file-system.d.ts +10 -0
  53. package/node_modules/@zigai/pi-extension-settings/dist/file-system.d.ts.map +1 -0
  54. package/node_modules/@zigai/pi-extension-settings/dist/file-system.js +115 -0
  55. package/node_modules/@zigai/pi-extension-settings/dist/file-system.js.map +1 -0
  56. package/node_modules/@zigai/pi-extension-settings/dist/index.d.ts +2 -0
  57. package/node_modules/@zigai/pi-extension-settings/dist/index.d.ts.map +1 -0
  58. package/node_modules/@zigai/pi-extension-settings/dist/index.js +2 -0
  59. package/node_modules/@zigai/pi-extension-settings/dist/index.js.map +1 -0
  60. package/node_modules/@zigai/pi-extension-settings/dist/json-value.d.ts +18 -0
  61. package/node_modules/@zigai/pi-extension-settings/dist/json-value.d.ts.map +1 -0
  62. package/node_modules/@zigai/pi-extension-settings/dist/json-value.js +56 -0
  63. package/node_modules/@zigai/pi-extension-settings/dist/json-value.js.map +1 -0
  64. package/node_modules/@zigai/pi-extension-settings/dist/paths.d.ts +11 -0
  65. package/node_modules/@zigai/pi-extension-settings/dist/paths.d.ts.map +1 -0
  66. package/node_modules/@zigai/pi-extension-settings/dist/paths.js +23 -0
  67. package/node_modules/@zigai/pi-extension-settings/dist/paths.js.map +1 -0
  68. package/node_modules/@zigai/pi-extension-settings/dist/pi-host-paths.d.ts +5 -0
  69. package/node_modules/@zigai/pi-extension-settings/dist/pi-host-paths.d.ts.map +1 -0
  70. package/node_modules/@zigai/pi-extension-settings/dist/pi-host-paths.js +21 -0
  71. package/node_modules/@zigai/pi-extension-settings/dist/pi-host-paths.js.map +1 -0
  72. package/node_modules/@zigai/pi-extension-settings/dist/pi.d.ts +106 -0
  73. package/node_modules/@zigai/pi-extension-settings/dist/pi.d.ts.map +1 -0
  74. package/node_modules/@zigai/pi-extension-settings/dist/pi.js +122 -0
  75. package/node_modules/@zigai/pi-extension-settings/dist/pi.js.map +1 -0
  76. package/node_modules/@zigai/pi-extension-settings/dist/pi.ts +2537 -0
  77. package/node_modules/@zigai/pi-extension-settings/dist/pi.ts.map +7 -0
  78. package/node_modules/@zigai/pi-extension-settings/dist/projects.d.ts +10 -0
  79. package/node_modules/@zigai/pi-extension-settings/dist/projects.d.ts.map +1 -0
  80. package/node_modules/@zigai/pi-extension-settings/dist/projects.js +177 -0
  81. package/node_modules/@zigai/pi-extension-settings/dist/projects.js.map +1 -0
  82. package/node_modules/@zigai/pi-extension-settings/dist/runtime.d.ts +40 -0
  83. package/node_modules/@zigai/pi-extension-settings/dist/runtime.d.ts.map +1 -0
  84. package/node_modules/@zigai/pi-extension-settings/dist/runtime.js +158 -0
  85. package/node_modules/@zigai/pi-extension-settings/dist/runtime.js.map +1 -0
  86. package/node_modules/@zigai/pi-extension-settings/dist/runtime.ts +158 -0
  87. package/node_modules/@zigai/pi-extension-settings/dist/runtime.ts.map +7 -0
  88. package/node_modules/@zigai/pi-extension-settings/dist/schema-document.d.ts +19 -0
  89. package/node_modules/@zigai/pi-extension-settings/dist/schema-document.d.ts.map +1 -0
  90. package/node_modules/@zigai/pi-extension-settings/dist/schema-document.js +168 -0
  91. package/node_modules/@zigai/pi-extension-settings/dist/schema-document.js.map +1 -0
  92. package/node_modules/@zigai/pi-extension-settings/dist/settings-documentation.d.ts +9 -0
  93. package/node_modules/@zigai/pi-extension-settings/dist/settings-documentation.d.ts.map +1 -0
  94. package/node_modules/@zigai/pi-extension-settings/dist/settings-documentation.js +242 -0
  95. package/node_modules/@zigai/pi-extension-settings/dist/settings-documentation.js.map +1 -0
  96. package/node_modules/@zigai/pi-extension-settings/dist/settings-layer.d.ts +59 -0
  97. package/node_modules/@zigai/pi-extension-settings/dist/settings-layer.d.ts.map +1 -0
  98. package/node_modules/@zigai/pi-extension-settings/dist/settings-layer.js +98 -0
  99. package/node_modules/@zigai/pi-extension-settings/dist/settings-layer.js.map +1 -0
  100. package/node_modules/@zigai/pi-extension-settings/dist/settings-loader.d.ts +80 -0
  101. package/node_modules/@zigai/pi-extension-settings/dist/settings-loader.d.ts.map +1 -0
  102. package/node_modules/@zigai/pi-extension-settings/dist/settings-loader.js +144 -0
  103. package/node_modules/@zigai/pi-extension-settings/dist/settings-loader.js.map +1 -0
  104. package/node_modules/@zigai/pi-extension-settings/dist/settings-merge.d.ts +5 -0
  105. package/node_modules/@zigai/pi-extension-settings/dist/settings-merge.d.ts.map +1 -0
  106. package/node_modules/@zigai/pi-extension-settings/dist/settings-merge.js +30 -0
  107. package/node_modules/@zigai/pi-extension-settings/dist/settings-merge.js.map +1 -0
  108. package/node_modules/@zigai/pi-extension-settings/dist/settings-revision.d.ts +10 -0
  109. package/node_modules/@zigai/pi-extension-settings/dist/settings-revision.d.ts.map +1 -0
  110. package/node_modules/@zigai/pi-extension-settings/dist/settings-revision.js +16 -0
  111. package/node_modules/@zigai/pi-extension-settings/dist/settings-revision.js.map +1 -0
  112. package/node_modules/@zigai/pi-extension-settings/dist/settings-transaction.d.ts +54 -0
  113. package/node_modules/@zigai/pi-extension-settings/dist/settings-transaction.d.ts.map +1 -0
  114. package/node_modules/@zigai/pi-extension-settings/dist/settings-transaction.js +202 -0
  115. package/node_modules/@zigai/pi-extension-settings/dist/settings-transaction.js.map +1 -0
  116. package/node_modules/@zigai/pi-extension-settings/dist/typebox-runtime.d.ts +5 -0
  117. package/node_modules/@zigai/pi-extension-settings/dist/typebox-runtime.d.ts.map +1 -0
  118. package/node_modules/@zigai/pi-extension-settings/dist/typebox-runtime.js +9 -0
  119. package/node_modules/@zigai/pi-extension-settings/dist/typebox-runtime.js.map +1 -0
  120. package/node_modules/@zigai/pi-extension-settings/docs/generation.md +71 -0
  121. package/node_modules/@zigai/pi-extension-settings/docs/manual-setup.md +98 -0
  122. package/node_modules/@zigai/pi-extension-settings/docs/runtime.md +100 -0
  123. package/node_modules/@zigai/pi-extension-settings/docs/ui-controls.md +31 -0
  124. package/node_modules/@zigai/pi-extension-settings/package.json +97 -0
  125. package/node_modules/@zigai/pi-mention-anything/README.md +113 -0
  126. package/node_modules/@zigai/pi-mention-anything/config.schema.json +313 -0
  127. package/node_modules/@zigai/pi-mention-anything/docs/command-protocol.md +106 -0
  128. package/node_modules/@zigai/pi-mention-anything/docs/providers.md +128 -0
  129. package/node_modules/@zigai/pi-mention-anything/examples/query-command.mjs +96 -0
  130. package/node_modules/@zigai/pi-mention-anything/examples/recursive-tree.ts +28 -0
  131. package/node_modules/@zigai/pi-mention-anything/examples/static.ts +28 -0
  132. package/node_modules/@zigai/pi-mention-anything/examples/tmux.ts +90 -0
  133. package/node_modules/@zigai/pi-mention-anything/examples/tree-settings.json +25 -0
  134. package/node_modules/@zigai/pi-mention-anything/package.json +58 -0
  135. package/node_modules/@zigai/pi-mention-anything/src/api.ts +75 -0
  136. package/node_modules/@zigai/pi-mention-anything/src/autocomplete.ts +231 -0
  137. package/node_modules/@zigai/pi-mention-anything/src/chain-autocomplete.ts +596 -0
  138. package/node_modules/@zigai/pi-mention-anything/src/chain-syntax.ts +345 -0
  139. package/node_modules/@zigai/pi-mention-anything/src/command-provider.ts +291 -0
  140. package/node_modules/@zigai/pi-mention-anything/src/configured-source.ts +66 -0
  141. package/node_modules/@zigai/pi-mention-anything/src/editor.ts +180 -0
  142. package/node_modules/@zigai/pi-mention-anything/src/expand-mentions.ts +162 -0
  143. package/node_modules/@zigai/pi-mention-anything/src/index.ts +54 -0
  144. package/node_modules/@zigai/pi-mention-anything/src/initial-suggestions.ts +190 -0
  145. package/node_modules/@zigai/pi-mention-anything/src/list-provider.ts +71 -0
  146. package/node_modules/@zigai/pi-mention-anything/src/mention-hub.ts +307 -0
  147. package/node_modules/@zigai/pi-mention-anything/src/mention-resolution.ts +374 -0
  148. package/node_modules/@zigai/pi-mention-anything/src/mention-syntax.ts +105 -0
  149. package/node_modules/@zigai/pi-mention-anything/src/register-mention.ts +89 -0
  150. package/node_modules/@zigai/pi-mention-anything/src/rendering.ts +53 -0
  151. package/node_modules/@zigai/pi-mention-anything/src/selected-items.ts +21 -0
  152. package/node_modules/@zigai/pi-mention-anything/src/selection-history.ts +135 -0
  153. package/node_modules/@zigai/pi-mention-anything/src/settings-input.ts +317 -0
  154. package/node_modules/@zigai/pi-mention-anything/src/settings.prevalidated.ts +57 -0
  155. package/node_modules/@zigai/pi-mention-anything/src/settings.ts +52 -0
  156. package/node_modules/@zigai/pi-mention-anything/src/source-contract.ts +174 -0
  157. package/node_modules/@zigai/pi-mention-anything/src/source-controller.ts +1070 -0
  158. package/node_modules/@zigai/pi-mention-anything/src/source-runtime.ts +99 -0
  159. package/node_modules/@zigai/pi-mention-skill/README.md +60 -0
  160. package/node_modules/@zigai/pi-mention-skill/config.schema.json +81 -0
  161. package/node_modules/@zigai/pi-mention-skill/package.json +56 -0
  162. package/node_modules/@zigai/pi-mention-skill/src/index.ts +60 -0
  163. package/node_modules/@zigai/pi-mention-skill/src/settings-input.ts +74 -0
  164. package/node_modules/@zigai/pi-mention-skill/src/settings.prevalidated.ts +18 -0
  165. package/node_modules/@zigai/pi-mention-skill/src/settings.ts +54 -0
  166. package/node_modules/@zigai/pi-mention-skill/src/skill-commands.ts +18 -0
  167. package/node_modules/@zigai/pi-mention-skill/src/skill-content.ts +60 -0
  168. package/node_modules/@zigai/pi-mention-skill/src/skill-provider.ts +105 -0
  169. package/node_modules/@zigai/pi-mention-skill/src/slash-skill-filter.ts +29 -0
  170. package/node_modules/argparse/LICENSE +21 -0
  171. package/node_modules/argparse/README.md +257 -0
  172. package/node_modules/argparse/index.js +3 -0
  173. package/node_modules/argparse/lib/action/append/constant.js +47 -0
  174. package/node_modules/argparse/lib/action/append.js +53 -0
  175. package/node_modules/argparse/lib/action/count.js +40 -0
  176. package/node_modules/argparse/lib/action/help.js +47 -0
  177. package/node_modules/argparse/lib/action/store/constant.js +43 -0
  178. package/node_modules/argparse/lib/action/store/false.js +27 -0
  179. package/node_modules/argparse/lib/action/store/true.js +26 -0
  180. package/node_modules/argparse/lib/action/store.js +50 -0
  181. package/node_modules/argparse/lib/action/subparsers.js +149 -0
  182. package/node_modules/argparse/lib/action/version.js +47 -0
  183. package/node_modules/argparse/lib/action.js +146 -0
  184. package/node_modules/argparse/lib/action_container.js +482 -0
  185. package/node_modules/argparse/lib/argparse.js +14 -0
  186. package/node_modules/argparse/lib/argument/error.js +50 -0
  187. package/node_modules/argparse/lib/argument/exclusive.js +54 -0
  188. package/node_modules/argparse/lib/argument/group.js +75 -0
  189. package/node_modules/argparse/lib/argument_parser.js +1161 -0
  190. package/node_modules/argparse/lib/const.js +21 -0
  191. package/node_modules/argparse/lib/help/added_formatters.js +87 -0
  192. package/node_modules/argparse/lib/help/formatter.js +795 -0
  193. package/node_modules/argparse/lib/namespace.js +76 -0
  194. package/node_modules/argparse/lib/utils.js +57 -0
  195. package/node_modules/argparse/package.json +34 -0
  196. package/node_modules/esprima/LICENSE.BSD +21 -0
  197. package/node_modules/esprima/README.md +46 -0
  198. package/node_modules/esprima/bin/esparse.js +139 -0
  199. package/node_modules/esprima/bin/esvalidate.js +236 -0
  200. package/node_modules/esprima/dist/esprima.js +6709 -0
  201. package/node_modules/esprima/package.json +112 -0
  202. package/node_modules/extend-shallow/LICENSE +21 -0
  203. package/node_modules/extend-shallow/README.md +61 -0
  204. package/node_modules/extend-shallow/index.js +33 -0
  205. package/node_modules/extend-shallow/package.json +56 -0
  206. package/node_modules/graceful-fs/LICENSE +15 -0
  207. package/node_modules/graceful-fs/README.md +143 -0
  208. package/node_modules/graceful-fs/clone.js +23 -0
  209. package/node_modules/graceful-fs/graceful-fs.js +448 -0
  210. package/node_modules/graceful-fs/legacy-streams.js +118 -0
  211. package/node_modules/graceful-fs/package.json +53 -0
  212. package/node_modules/graceful-fs/polyfills.js +355 -0
  213. package/node_modules/gray-matter/LICENSE +21 -0
  214. package/node_modules/gray-matter/README.md +565 -0
  215. package/node_modules/gray-matter/gray-matter.d.ts +114 -0
  216. package/node_modules/gray-matter/index.js +228 -0
  217. package/node_modules/gray-matter/lib/defaults.js +18 -0
  218. package/node_modules/gray-matter/lib/engine.js +30 -0
  219. package/node_modules/gray-matter/lib/engines.js +54 -0
  220. package/node_modules/gray-matter/lib/excerpt.js +32 -0
  221. package/node_modules/gray-matter/lib/parse.js +13 -0
  222. package/node_modules/gray-matter/lib/stringify.js +56 -0
  223. package/node_modules/gray-matter/lib/to-file.js +43 -0
  224. package/node_modules/gray-matter/lib/utils.js +66 -0
  225. package/node_modules/gray-matter/package.json +127 -0
  226. package/node_modules/is-extendable/LICENSE +21 -0
  227. package/node_modules/is-extendable/README.md +72 -0
  228. package/node_modules/is-extendable/index.js +13 -0
  229. package/node_modules/is-extendable/package.json +51 -0
  230. package/node_modules/js-yaml/LICENSE +21 -0
  231. package/node_modules/js-yaml/README.md +302 -0
  232. package/node_modules/js-yaml/bin/js-yaml.js +132 -0
  233. package/node_modules/js-yaml/dist/js-yaml.js +4024 -0
  234. package/node_modules/js-yaml/dist/js-yaml.min.js +1 -0
  235. package/node_modules/js-yaml/index.js +7 -0
  236. package/node_modules/js-yaml/lib/js-yaml/common.js +59 -0
  237. package/node_modules/js-yaml/lib/js-yaml/dumper.js +850 -0
  238. package/node_modules/js-yaml/lib/js-yaml/exception.js +43 -0
  239. package/node_modules/js-yaml/lib/js-yaml/loader.js +1679 -0
  240. package/node_modules/js-yaml/lib/js-yaml/mark.js +76 -0
  241. package/node_modules/js-yaml/lib/js-yaml/schema/core.js +18 -0
  242. package/node_modules/js-yaml/lib/js-yaml/schema/default_full.js +25 -0
  243. package/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js +28 -0
  244. package/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js +17 -0
  245. package/node_modules/js-yaml/lib/js-yaml/schema/json.js +25 -0
  246. package/node_modules/js-yaml/lib/js-yaml/schema.js +108 -0
  247. package/node_modules/js-yaml/lib/js-yaml/type/binary.js +138 -0
  248. package/node_modules/js-yaml/lib/js-yaml/type/bool.js +35 -0
  249. package/node_modules/js-yaml/lib/js-yaml/type/float.js +116 -0
  250. package/node_modules/js-yaml/lib/js-yaml/type/int.js +173 -0
  251. package/node_modules/js-yaml/lib/js-yaml/type/js/function.js +93 -0
  252. package/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js +60 -0
  253. package/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js +28 -0
  254. package/node_modules/js-yaml/lib/js-yaml/type/map.js +8 -0
  255. package/node_modules/js-yaml/lib/js-yaml/type/merge.js +12 -0
  256. package/node_modules/js-yaml/lib/js-yaml/type/null.js +34 -0
  257. package/node_modules/js-yaml/lib/js-yaml/type/omap.js +44 -0
  258. package/node_modules/js-yaml/lib/js-yaml/type/pairs.js +53 -0
  259. package/node_modules/js-yaml/lib/js-yaml/type/seq.js +8 -0
  260. package/node_modules/js-yaml/lib/js-yaml/type/set.js +29 -0
  261. package/node_modules/js-yaml/lib/js-yaml/type/str.js +8 -0
  262. package/node_modules/js-yaml/lib/js-yaml/type/timestamp.js +88 -0
  263. package/node_modules/js-yaml/lib/js-yaml/type.js +61 -0
  264. package/node_modules/js-yaml/lib/js-yaml.js +39 -0
  265. package/node_modules/js-yaml/package.json +52 -0
  266. package/node_modules/kind-of/LICENSE +21 -0
  267. package/node_modules/kind-of/README.md +367 -0
  268. package/node_modules/kind-of/index.js +129 -0
  269. package/node_modules/kind-of/package.json +88 -0
  270. package/node_modules/node-addon-api/common 2.gypi +21 -0
  271. package/node_modules/node-addon-api/except 2.gypi +25 -0
  272. package/node_modules/node-addon-api/napi 2.h +3463 -0
  273. package/node_modules/node-addon-api/napi-inl 2.h +7250 -0
  274. package/node_modules/node-addon-api/napi-inl.deprecated 2.h +186 -0
  275. package/node_modules/node-addon-api/node_addon_api 2.gyp +42 -0
  276. package/node_modules/node-addon-api/node_api 2.gyp +9 -0
  277. package/node_modules/node-addon-api/noexcept 2.gypi +26 -0
  278. package/node_modules/node-addon-api/nothing 2.c +0 -0
  279. package/node_modules/pi-toggle-skills/README.md +213 -0
  280. package/node_modules/pi-toggle-skills/package.json +60 -0
  281. package/node_modules/pi-toggle-skills/src/index.ts +112 -0
  282. package/node_modules/pi-toggle-skills/src/skill-discovery.ts +258 -0
  283. package/node_modules/pi-toggle-skills/src/skill-selector.ts +435 -0
  284. package/node_modules/pi-toggle-skills/toggle-skills 2.ts +316 -0
  285. package/node_modules/pi-toggle-skills/toggle-skills.ts +316 -0
  286. package/node_modules/pi-toggle-skills/vitest.config 2.ts +15 -0
  287. package/node_modules/pi-toggle-skills/vitest.config.ts +15 -0
  288. package/node_modules/proper-lockfile/LICENSE +21 -0
  289. package/node_modules/proper-lockfile/README.md +183 -0
  290. package/node_modules/proper-lockfile/index.js +40 -0
  291. package/node_modules/proper-lockfile/lib/adapter.js +85 -0
  292. package/node_modules/proper-lockfile/lib/lockfile.js +342 -0
  293. package/node_modules/proper-lockfile/lib/mtime-precision.js +55 -0
  294. package/node_modules/proper-lockfile/node_modules/retry/.npmignore +3 -0
  295. package/node_modules/proper-lockfile/node_modules/retry/.travis.yml +15 -0
  296. package/node_modules/proper-lockfile/node_modules/retry/License +21 -0
  297. package/node_modules/proper-lockfile/node_modules/retry/Makefile +18 -0
  298. package/node_modules/proper-lockfile/node_modules/retry/README.md +227 -0
  299. package/node_modules/proper-lockfile/node_modules/retry/equation.gif +0 -0
  300. package/node_modules/proper-lockfile/node_modules/retry/example/dns.js +31 -0
  301. package/node_modules/proper-lockfile/node_modules/retry/example/stop.js +40 -0
  302. package/node_modules/proper-lockfile/node_modules/retry/index.js +1 -0
  303. package/node_modules/proper-lockfile/node_modules/retry/lib/retry.js +100 -0
  304. package/node_modules/proper-lockfile/node_modules/retry/lib/retry_operation.js +158 -0
  305. package/node_modules/proper-lockfile/node_modules/retry/package.json +32 -0
  306. package/node_modules/proper-lockfile/node_modules/retry/test/common.js +10 -0
  307. package/node_modules/proper-lockfile/node_modules/retry/test/integration/test-forever.js +24 -0
  308. package/node_modules/proper-lockfile/node_modules/retry/test/integration/test-retry-operation.js +258 -0
  309. package/node_modules/proper-lockfile/node_modules/retry/test/integration/test-retry-wrap.js +101 -0
  310. package/node_modules/proper-lockfile/node_modules/retry/test/integration/test-timeouts.js +69 -0
  311. package/node_modules/proper-lockfile/package.json +71 -0
  312. package/node_modules/section-matter/LICENSE +21 -0
  313. package/node_modules/section-matter/README.md +236 -0
  314. package/node_modules/section-matter/index.js +136 -0
  315. package/node_modules/section-matter/package.json +55 -0
  316. package/node_modules/signal-exit/LICENSE.txt +16 -0
  317. package/node_modules/signal-exit/README.md +39 -0
  318. package/node_modules/signal-exit/index.js +202 -0
  319. package/node_modules/signal-exit/package.json +38 -0
  320. package/node_modules/signal-exit/signals.js +53 -0
  321. package/node_modules/sprintf-js/.npmignore +1 -0
  322. package/node_modules/sprintf-js/.npmignore 2 +1 -0
  323. package/node_modules/sprintf-js/LICENSE +24 -0
  324. package/node_modules/sprintf-js/LICENSE 2 +24 -0
  325. package/node_modules/sprintf-js/README 2.md +88 -0
  326. package/node_modules/sprintf-js/README.md +88 -0
  327. package/node_modules/sprintf-js/bower 2.json +14 -0
  328. package/node_modules/sprintf-js/bower.json +14 -0
  329. package/node_modules/sprintf-js/demo/angular.html +20 -0
  330. package/node_modules/sprintf-js/dist/angular-sprintf.min.js +4 -0
  331. package/node_modules/sprintf-js/dist/angular-sprintf.min.js.map +1 -0
  332. package/node_modules/sprintf-js/dist/angular-sprintf.min.map +1 -0
  333. package/node_modules/sprintf-js/dist/sprintf.min.js +4 -0
  334. package/node_modules/sprintf-js/dist/sprintf.min.js.map +1 -0
  335. package/node_modules/sprintf-js/dist/sprintf.min.map +1 -0
  336. package/node_modules/sprintf-js/gruntfile 2.js +36 -0
  337. package/node_modules/sprintf-js/gruntfile.js +36 -0
  338. package/node_modules/sprintf-js/package 2.json +22 -0
  339. package/node_modules/sprintf-js/package.json +22 -0
  340. package/node_modules/sprintf-js/src/angular-sprintf.js +18 -0
  341. package/node_modules/sprintf-js/src/sprintf.js +208 -0
  342. package/node_modules/sprintf-js/test/test.js +82 -0
  343. package/node_modules/strip-bom-string/LICENSE +21 -0
  344. package/node_modules/strip-bom-string/README.md +66 -0
  345. package/node_modules/strip-bom-string/index.js +15 -0
  346. package/node_modules/strip-bom-string/package.json +60 -0
  347. package/node_modules/tree-sitter-bash/tree-sitter-bash 2.wasm +0 -0
  348. package/node_modules/typebox/license 2 +23 -0
  349. package/node_modules/typebox/package 2.json +87 -0
  350. package/node_modules/typebox/readme 2.md +370 -0
  351. package/node_modules/zod/compile 2.cjs +96 -0
  352. package/node_modules/zod/compile 2.js +52 -0
  353. package/node_modules/zod/index 2.cjs +52 -0
  354. package/node_modules/zod/index 2.js +7 -0
  355. package/package.json +13 -4
@@ -0,0 +1,236 @@
1
+ # section-matter [![NPM version](https://img.shields.io/npm/v/section-matter.svg?style=flat)](https://www.npmjs.com/package/section-matter) [![NPM monthly downloads](https://img.shields.io/npm/dm/section-matter.svg?style=flat)](https://npmjs.org/package/section-matter) [![NPM total downloads](https://img.shields.io/npm/dt/section-matter.svg?style=flat)](https://npmjs.org/package/section-matter) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/section-matter.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/section-matter)
2
+
3
+ > Like front-matter, but supports multiple sections in a document.
4
+
5
+ Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
6
+
7
+ ## Install
8
+ Install with [npm](https://www.npmjs.com/):
9
+
10
+ ```sh
11
+ $ npm install --save section-matter
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ **Params**
17
+
18
+ * `input` **{String|Buffer|Object}**: If input is an object, it's `content` property must be a string or buffer.
19
+ * **{Object}**: options
20
+ * `returns` **{Object}**: Returns an object with a `content` string and an array of `sections` objects.
21
+
22
+ **Example**
23
+
24
+ ```js
25
+ var sections = require('{%= name %}');
26
+ var result = sections(input, options);
27
+ // { content: 'Content before sections', sections: [] }
28
+ ```
29
+
30
+ See available [options](#options).
31
+
32
+ ## Example
33
+
34
+ _With the exception of front-matter, **which must be the very first thing in the string**, the opening delimiter of all other sections must be followed by a string to be used as the `key` for the section._
35
+
36
+ Given the following string:
37
+
38
+ ```
39
+ Content before the sections.
40
+
41
+ ---
42
+
43
+ More content.
44
+
45
+ ---one
46
+ title: One
47
+ ---
48
+
49
+ This is the first section.
50
+ ```
51
+
52
+ The following code:
53
+
54
+ ```js
55
+ console.log(sections(input));
56
+ ```
57
+
58
+ Results in:
59
+
60
+ ```js
61
+ {
62
+ content: 'Content before the sections.\n\n---\n\nMore content.\n',
63
+ sections: [
64
+ {
65
+ key: 'one',
66
+ data: 'title: One',
67
+ content: '\nThis is the first section.'
68
+ }
69
+ ]
70
+ }
71
+ ```
72
+
73
+ ## Options
74
+
75
+ ### options.section_parse
76
+
77
+ **Type**: `function`
78
+
79
+ **Default**: `undefined`
80
+
81
+ Function to be called on each section after it's parsed from the string.
82
+
83
+ **Example**
84
+
85
+ Given the following string (`foo.md`):
86
+
87
+ ```
88
+ This is content before the sections.
89
+
90
+ ---one
91
+ title: First section
92
+ ---
93
+
94
+ This is section one.
95
+
96
+ ---two
97
+ title: Second section
98
+ ---
99
+
100
+ This is section two.
101
+ ```
102
+
103
+ Using the following custom `section_parse` function:
104
+
105
+ ```js
106
+ var fs = require('fs');
107
+ var path = require('path');
108
+ var yaml = require('js-yaml');
109
+ var sections = require('section-matter');
110
+
111
+ var str = fs.readFileSync('foo.md');
112
+ var options = {
113
+ section_parse: function(section) {
114
+ console.log(section)
115
+ section.key = 'section-' + section.key;
116
+ section.data = yaml.safeLoad(section.data);
117
+ }
118
+ };
119
+
120
+ var result = sections(str, options);
121
+ console.log(result);
122
+ ```
123
+
124
+ Results in:
125
+
126
+ ```js
127
+ {
128
+ content: 'This is content before the sections.\n',
129
+ sections: [
130
+ {
131
+ key: 'section-one',
132
+ data: { title: 'First section' },
133
+ content: '\nThis is section one.\n'
134
+ },
135
+ {
136
+ key: 'section-two',
137
+ data: { title: 'Second section' },
138
+ content: '\nThis is section two.\n'
139
+ }
140
+ ]
141
+ }
142
+ ```
143
+
144
+ ### options.section_delimiter
145
+
146
+ **Type**: `string`
147
+
148
+ **Default**: `---`
149
+
150
+ Delimiter to use as the separator for sections. _With the exception of front-matter, which must be the very first thing in the string, the opening delimiter of all other sections must be followed by a string to be used as the `key` for the section._
151
+
152
+ **Example**
153
+
154
+ ```js
155
+ var input = '~~~\ntitle: bar\n~~~\n\nfoo\n~~~one\ntitle: One\n~~~\nThis is one';
156
+ console.log(sections(input, {section_delimiter: '~~~'}));
157
+ ```
158
+
159
+ Results in:
160
+
161
+ ```js
162
+ {
163
+ content: '',
164
+ sections: [
165
+ {
166
+ key: '',
167
+ data: 'title: bar',
168
+ content: '\nfoo'
169
+ },
170
+ {
171
+ key: 'one',
172
+ data: 'title: One',
173
+ content: 'This is one'
174
+ }
175
+ ]
176
+ }
177
+ ```
178
+
179
+ ## About
180
+ <details>
181
+ <summary><strong>Contributing</strong></summary>
182
+
183
+ Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
184
+
185
+ Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.
186
+
187
+ </details>
188
+
189
+ <details>
190
+ <summary><strong>Running Tests</strong></summary>
191
+
192
+ Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
193
+
194
+ ```sh
195
+ $ npm install && npm test
196
+ ```
197
+
198
+ </details>
199
+
200
+ <details>
201
+ <summary><strong>Building docs</strong></summary>
202
+
203
+ _(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
204
+
205
+ To generate the readme, run the following command:
206
+
207
+ ```sh
208
+ $ npm install -g verbose/verb#dev verb-generate-readme && verb
209
+ ```
210
+
211
+ </details>
212
+
213
+ ### Related projects
214
+
215
+ You might also be interested in these projects:
216
+
217
+ - [assemble](https://www.npmjs.com/package/assemble): Get the rocks out of your socks! Assemble makes you fast at creating web projects… [more](https://github.com/assemble/assemble) | [homepage](https://github.com/assemble/assemble "Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websit")
218
+ - [gray-matter](https://www.npmjs.com/package/gray-matter): Parse front-matter from a string or file. Fast, reliable and easy to use. Parses YAML… [more](https://github.com/jonschlinkert/gray-matter) | [homepage](https://github.com/jonschlinkert/gray-matter "Parse front-matter from a string or file. Fast, reliable and easy to use. Parses YAML front matter by default, but also has support for YAML, JSON, TOML or Coffee Front-Matter, with options to set custom delimiters. Used by metalsmith, assemble, verb and ")
219
+ - [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb) | [homepage](https://github.com/verbose/verb "Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.")
220
+
221
+ ### Contributors
222
+
223
+ ### Author
224
+ **Jon Schlinkert**
225
+
226
+ + [github/jonschlinkert](https://github.com/jonschlinkert)
227
+ + [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
228
+
229
+ ### License
230
+ Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
231
+ Released under the [MIT License](LICENSE).
232
+
233
+ ***
234
+
235
+ _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on October 23, 2017._
236
+
@@ -0,0 +1,136 @@
1
+ 'use strict';
2
+
3
+ var typeOf = require('kind-of');
4
+ var extend = require('extend-shallow');
5
+
6
+ /**
7
+ * Parse sections in `input` with the given `options`.
8
+ *
9
+ * ```js
10
+ * var sections = require('{%= name %}');
11
+ * var result = sections(input, options);
12
+ * // { content: 'Content before sections', sections: [] }
13
+ * ```
14
+ * @param {String|Buffer|Object} `input` If input is an object, it's `content` property must be a string or buffer.
15
+ * @param {Object} options
16
+ * @return {Object} Returns an object with a `content` string and an array of `sections` objects.
17
+ * @api public
18
+ */
19
+
20
+ module.exports = function(input, options) {
21
+ if (typeof options === 'function') {
22
+ options = { parse: options };
23
+ }
24
+
25
+ var file = toObject(input);
26
+ var defaults = {section_delimiter: '---', parse: identity};
27
+ var opts = extend({}, defaults, options);
28
+ var delim = opts.section_delimiter;
29
+ var lines = file.content.split(/\r?\n/);
30
+ var sections = null;
31
+ var section = createSection();
32
+ var content = [];
33
+ var stack = [];
34
+
35
+ function initSections(val) {
36
+ file.content = val;
37
+ sections = [];
38
+ content = [];
39
+ }
40
+
41
+ function closeSection(val) {
42
+ if (stack.length) {
43
+ section.key = getKey(stack[0], delim);
44
+ section.content = val;
45
+ opts.parse(section, sections);
46
+ sections.push(section);
47
+ section = createSection();
48
+ content = [];
49
+ stack = [];
50
+ }
51
+ }
52
+
53
+ for (var i = 0; i < lines.length; i++) {
54
+ var line = lines[i];
55
+ var len = stack.length;
56
+ var ln = line.trim();
57
+
58
+ if (isDelimiter(ln, delim)) {
59
+ if (ln.length === 3 && i !== 0) {
60
+ if (len === 0 || len === 2) {
61
+ content.push(line);
62
+ continue;
63
+ }
64
+ stack.push(ln);
65
+ section.data = content.join('\n');
66
+ content = [];
67
+ continue;
68
+ }
69
+
70
+ if (sections === null) {
71
+ initSections(content.join('\n'));
72
+ }
73
+
74
+ if (len === 2) {
75
+ closeSection(content.join('\n'));
76
+ }
77
+
78
+ stack.push(ln);
79
+ continue;
80
+ }
81
+
82
+ content.push(line);
83
+ }
84
+
85
+ if (sections === null) {
86
+ initSections(content.join('\n'));
87
+ } else {
88
+ closeSection(content.join('\n'));
89
+ }
90
+
91
+ file.sections = sections;
92
+ return file;
93
+ };
94
+
95
+ function isDelimiter(line, delim) {
96
+ if (line.slice(0, delim.length) !== delim) {
97
+ return false;
98
+ }
99
+ if (line.charAt(delim.length + 1) === delim.slice(-1)) {
100
+ return false;
101
+ }
102
+ return true;
103
+ }
104
+
105
+ function toObject(input) {
106
+ if (typeOf(input) !== 'object') {
107
+ input = { content: input };
108
+ }
109
+
110
+ if (typeof input.content !== 'string' && !isBuffer(input.content)) {
111
+ throw new TypeError('expected a buffer or string');
112
+ }
113
+
114
+ input.content = input.content.toString();
115
+ input.sections = [];
116
+ return input;
117
+ }
118
+
119
+ function getKey(val, delim) {
120
+ return val ? val.slice(delim.length).trim() : '';
121
+ }
122
+
123
+ function createSection() {
124
+ return { key: '', data: '', content: '' };
125
+ }
126
+
127
+ function identity(val) {
128
+ return val;
129
+ }
130
+
131
+ function isBuffer(val) {
132
+ if (val && val.constructor && typeof val.constructor.isBuffer === 'function') {
133
+ return val.constructor.isBuffer(val);
134
+ }
135
+ return false;
136
+ }
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "section-matter",
3
+ "description": "Like front-matter, but supports multiple sections in a document.",
4
+ "version": "1.0.0",
5
+ "homepage": "https://github.com/jonschlinkert/section-matter",
6
+ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
7
+ "repository": "jonschlinkert/section-matter",
8
+ "bugs": {
9
+ "url": "https://github.com/jonschlinkert/section-matter/issues"
10
+ },
11
+ "license": "MIT",
12
+ "files": [
13
+ "index.js"
14
+ ],
15
+ "main": "index.js",
16
+ "engines": {
17
+ "node": ">=4"
18
+ },
19
+ "scripts": {
20
+ "test": "mocha"
21
+ },
22
+ "dependencies": {
23
+ "extend-shallow": "^2.0.1",
24
+ "kind-of": "^6.0.0"
25
+ },
26
+ "devDependencies": {
27
+ "gulp-format-md": "^1.0.0",
28
+ "js-yaml": "^3.10.0",
29
+ "mocha": "^4.0.1"
30
+ },
31
+ "keywords": [
32
+ "matter",
33
+ "section"
34
+ ],
35
+ "verb": {
36
+ "toc": false,
37
+ "layout": "default",
38
+ "tasks": [
39
+ "readme"
40
+ ],
41
+ "plugins": [
42
+ "gulp-format-md"
43
+ ],
44
+ "related": {
45
+ "list": [
46
+ "gray-matter",
47
+ "assemble",
48
+ "verb"
49
+ ]
50
+ },
51
+ "lint": {
52
+ "reflinks": true
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,16 @@
1
+ The ISC License
2
+
3
+ Copyright (c) 2015, Contributors
4
+
5
+ Permission to use, copy, modify, and/or distribute this software
6
+ for any purpose with or without fee is hereby granted, provided
7
+ that the above copyright notice and this permission notice
8
+ appear in all copies.
9
+
10
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
12
+ OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
13
+ LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
14
+ OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
15
+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
16
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,39 @@
1
+ # signal-exit
2
+
3
+ [![Build Status](https://travis-ci.org/tapjs/signal-exit.png)](https://travis-ci.org/tapjs/signal-exit)
4
+ [![Coverage](https://coveralls.io/repos/tapjs/signal-exit/badge.svg?branch=master)](https://coveralls.io/r/tapjs/signal-exit?branch=master)
5
+ [![NPM version](https://img.shields.io/npm/v/signal-exit.svg)](https://www.npmjs.com/package/signal-exit)
6
+ [![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)
7
+
8
+ When you want to fire an event no matter how a process exits:
9
+
10
+ * reaching the end of execution.
11
+ * explicitly having `process.exit(code)` called.
12
+ * having `process.kill(pid, sig)` called.
13
+ * receiving a fatal signal from outside the process
14
+
15
+ Use `signal-exit`.
16
+
17
+ ```js
18
+ var onExit = require('signal-exit')
19
+
20
+ onExit(function (code, signal) {
21
+ console.log('process exited!')
22
+ })
23
+ ```
24
+
25
+ ## API
26
+
27
+ `var remove = onExit(function (code, signal) {}, options)`
28
+
29
+ The return value of the function is a function that will remove the
30
+ handler.
31
+
32
+ Note that the function *only* fires for signals if the signal would
33
+ cause the process to exit. That is, there are no other listeners, and
34
+ it is a fatal signal.
35
+
36
+ ## Options
37
+
38
+ * `alwaysLast`: Run this handler after any other signal or exit
39
+ handlers. This causes `process.emit` to be monkeypatched.
@@ -0,0 +1,202 @@
1
+ // Note: since nyc uses this module to output coverage, any lines
2
+ // that are in the direct sync flow of nyc's outputCoverage are
3
+ // ignored, since we can never get coverage for them.
4
+ // grab a reference to node's real process object right away
5
+ var process = global.process
6
+
7
+ const processOk = function (process) {
8
+ return process &&
9
+ typeof process === 'object' &&
10
+ typeof process.removeListener === 'function' &&
11
+ typeof process.emit === 'function' &&
12
+ typeof process.reallyExit === 'function' &&
13
+ typeof process.listeners === 'function' &&
14
+ typeof process.kill === 'function' &&
15
+ typeof process.pid === 'number' &&
16
+ typeof process.on === 'function'
17
+ }
18
+
19
+ // some kind of non-node environment, just no-op
20
+ /* istanbul ignore if */
21
+ if (!processOk(process)) {
22
+ module.exports = function () {
23
+ return function () {}
24
+ }
25
+ } else {
26
+ var assert = require('assert')
27
+ var signals = require('./signals.js')
28
+ var isWin = /^win/i.test(process.platform)
29
+
30
+ var EE = require('events')
31
+ /* istanbul ignore if */
32
+ if (typeof EE !== 'function') {
33
+ EE = EE.EventEmitter
34
+ }
35
+
36
+ var emitter
37
+ if (process.__signal_exit_emitter__) {
38
+ emitter = process.__signal_exit_emitter__
39
+ } else {
40
+ emitter = process.__signal_exit_emitter__ = new EE()
41
+ emitter.count = 0
42
+ emitter.emitted = {}
43
+ }
44
+
45
+ // Because this emitter is a global, we have to check to see if a
46
+ // previous version of this library failed to enable infinite listeners.
47
+ // I know what you're about to say. But literally everything about
48
+ // signal-exit is a compromise with evil. Get used to it.
49
+ if (!emitter.infinite) {
50
+ emitter.setMaxListeners(Infinity)
51
+ emitter.infinite = true
52
+ }
53
+
54
+ module.exports = function (cb, opts) {
55
+ /* istanbul ignore if */
56
+ if (!processOk(global.process)) {
57
+ return function () {}
58
+ }
59
+ assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler')
60
+
61
+ if (loaded === false) {
62
+ load()
63
+ }
64
+
65
+ var ev = 'exit'
66
+ if (opts && opts.alwaysLast) {
67
+ ev = 'afterexit'
68
+ }
69
+
70
+ var remove = function () {
71
+ emitter.removeListener(ev, cb)
72
+ if (emitter.listeners('exit').length === 0 &&
73
+ emitter.listeners('afterexit').length === 0) {
74
+ unload()
75
+ }
76
+ }
77
+ emitter.on(ev, cb)
78
+
79
+ return remove
80
+ }
81
+
82
+ var unload = function unload () {
83
+ if (!loaded || !processOk(global.process)) {
84
+ return
85
+ }
86
+ loaded = false
87
+
88
+ signals.forEach(function (sig) {
89
+ try {
90
+ process.removeListener(sig, sigListeners[sig])
91
+ } catch (er) {}
92
+ })
93
+ process.emit = originalProcessEmit
94
+ process.reallyExit = originalProcessReallyExit
95
+ emitter.count -= 1
96
+ }
97
+ module.exports.unload = unload
98
+
99
+ var emit = function emit (event, code, signal) {
100
+ /* istanbul ignore if */
101
+ if (emitter.emitted[event]) {
102
+ return
103
+ }
104
+ emitter.emitted[event] = true
105
+ emitter.emit(event, code, signal)
106
+ }
107
+
108
+ // { <signal>: <listener fn>, ... }
109
+ var sigListeners = {}
110
+ signals.forEach(function (sig) {
111
+ sigListeners[sig] = function listener () {
112
+ /* istanbul ignore if */
113
+ if (!processOk(global.process)) {
114
+ return
115
+ }
116
+ // If there are no other listeners, an exit is coming!
117
+ // Simplest way: remove us and then re-send the signal.
118
+ // We know that this will kill the process, so we can
119
+ // safely emit now.
120
+ var listeners = process.listeners(sig)
121
+ if (listeners.length === emitter.count) {
122
+ unload()
123
+ emit('exit', null, sig)
124
+ /* istanbul ignore next */
125
+ emit('afterexit', null, sig)
126
+ /* istanbul ignore next */
127
+ if (isWin && sig === 'SIGHUP') {
128
+ // "SIGHUP" throws an `ENOSYS` error on Windows,
129
+ // so use a supported signal instead
130
+ sig = 'SIGINT'
131
+ }
132
+ /* istanbul ignore next */
133
+ process.kill(process.pid, sig)
134
+ }
135
+ }
136
+ })
137
+
138
+ module.exports.signals = function () {
139
+ return signals
140
+ }
141
+
142
+ var loaded = false
143
+
144
+ var load = function load () {
145
+ if (loaded || !processOk(global.process)) {
146
+ return
147
+ }
148
+ loaded = true
149
+
150
+ // This is the number of onSignalExit's that are in play.
151
+ // It's important so that we can count the correct number of
152
+ // listeners on signals, and don't wait for the other one to
153
+ // handle it instead of us.
154
+ emitter.count += 1
155
+
156
+ signals = signals.filter(function (sig) {
157
+ try {
158
+ process.on(sig, sigListeners[sig])
159
+ return true
160
+ } catch (er) {
161
+ return false
162
+ }
163
+ })
164
+
165
+ process.emit = processEmit
166
+ process.reallyExit = processReallyExit
167
+ }
168
+ module.exports.load = load
169
+
170
+ var originalProcessReallyExit = process.reallyExit
171
+ var processReallyExit = function processReallyExit (code) {
172
+ /* istanbul ignore if */
173
+ if (!processOk(global.process)) {
174
+ return
175
+ }
176
+ process.exitCode = code || /* istanbul ignore next */ 0
177
+ emit('exit', process.exitCode, null)
178
+ /* istanbul ignore next */
179
+ emit('afterexit', process.exitCode, null)
180
+ /* istanbul ignore next */
181
+ originalProcessReallyExit.call(process, process.exitCode)
182
+ }
183
+
184
+ var originalProcessEmit = process.emit
185
+ var processEmit = function processEmit (ev, arg) {
186
+ if (ev === 'exit' && processOk(global.process)) {
187
+ /* istanbul ignore else */
188
+ if (arg !== undefined) {
189
+ process.exitCode = arg
190
+ }
191
+ var ret = originalProcessEmit.apply(this, arguments)
192
+ /* istanbul ignore next */
193
+ emit('exit', process.exitCode, null)
194
+ /* istanbul ignore next */
195
+ emit('afterexit', process.exitCode, null)
196
+ /* istanbul ignore next */
197
+ return ret
198
+ } else {
199
+ return originalProcessEmit.apply(this, arguments)
200
+ }
201
+ }
202
+ }