@eagleoutice/flowr 2.12.2 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (319) hide show
  1. package/README.md +38 -91
  2. package/abstract-interpretation/data-frame/dataframe-domain.d.ts +3 -3
  3. package/abstract-interpretation/data-frame/dataframe-domain.js +14 -6
  4. package/abstract-interpretation/data-frame/semantics.js +12 -16
  5. package/abstract-interpretation/domains/abstract-domain.d.ts +46 -44
  6. package/abstract-interpretation/domains/abstract-domain.js +146 -6
  7. package/abstract-interpretation/domains/bounded-set-domain.d.ts +16 -25
  8. package/abstract-interpretation/domains/bounded-set-domain.js +22 -69
  9. package/abstract-interpretation/domains/interval-domain.d.ts +27 -36
  10. package/abstract-interpretation/domains/interval-domain.js +111 -146
  11. package/abstract-interpretation/domains/lattice.d.ts +3 -3
  12. package/abstract-interpretation/domains/multi-value-state-domain.js +3 -3
  13. package/abstract-interpretation/domains/partial-product-domain.d.ts +12 -19
  14. package/abstract-interpretation/domains/partial-product-domain.js +21 -54
  15. package/abstract-interpretation/domains/positive-interval-domain.d.ts +8 -12
  16. package/abstract-interpretation/domains/positive-interval-domain.js +21 -50
  17. package/abstract-interpretation/domains/product-domain.d.ts +1 -1
  18. package/abstract-interpretation/domains/product-domain.js +4 -4
  19. package/abstract-interpretation/domains/set-range-domain.d.ts +60 -56
  20. package/abstract-interpretation/domains/set-range-domain.js +141 -200
  21. package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +17 -23
  22. package/abstract-interpretation/domains/set-upper-bound-domain.js +59 -103
  23. package/abstract-interpretation/domains/singleton-domain.d.ts +15 -18
  24. package/abstract-interpretation/domains/singleton-domain.js +33 -72
  25. package/abstract-interpretation/domains/state-abstract-domain.d.ts +12 -16
  26. package/abstract-interpretation/domains/state-abstract-domain.js +36 -126
  27. package/abstract-interpretation/domains/state-domain-like.d.ts +2 -2
  28. package/abstract-interpretation/domains/value-abstract-domain.d.ts +120 -0
  29. package/abstract-interpretation/domains/{satisfiable-domain.js → value-abstract-domain.js} +14 -2
  30. package/benchmark/slicer.d.ts +2 -2
  31. package/benchmark/slicer.js +6 -5
  32. package/cli/common/options.d.ts +10 -0
  33. package/cli/common/options.js +2 -0
  34. package/cli/common/scripts-info.d.ts +10 -0
  35. package/cli/flowr-main-options.d.ts +4 -0
  36. package/cli/flowr-main-options.js +5 -0
  37. package/cli/flowr.d.ts +5 -0
  38. package/cli/flowr.js +15 -7
  39. package/cli/repl/commands/repl-query.js +42 -20
  40. package/cli/repl/commands/repl-signature.js +2 -2
  41. package/cli/repl/core.d.ts +14 -5
  42. package/cli/repl/core.js +32 -17
  43. package/cli/repl/parser/slice-query-parser.d.ts +69 -8
  44. package/cli/repl/parser/slice-query-parser.js +82 -13
  45. package/cli/repl/path-input.d.ts +6 -0
  46. package/cli/repl/path-input.js +41 -0
  47. package/cli/repl/print-version.js +3 -5
  48. package/cli/slicer-app.d.ts +2 -0
  49. package/cli/slicer-app.js +2 -1
  50. package/config.d.ts +54 -6
  51. package/config.js +133 -12
  52. package/control-flow/control-flow-graph.d.ts +3 -2
  53. package/control-flow/control-flow-graph.js +34 -14
  54. package/control-flow/semantic-cfg-guided-visitor.d.ts +3 -0
  55. package/control-flow/semantic-cfg-guided-visitor.js +3 -0
  56. package/core/steps/all/static-slicing/10-reconstruct.d.ts +6 -0
  57. package/core/steps/all/static-slicing/10-reconstruct.js +3 -1
  58. package/data/r-base-packages.generated.d.ts +1 -1
  59. package/data/r-base-packages.generated.js +3 -3
  60. package/data/sigdb/sigdb.remote.json +53 -53
  61. package/dataflow/environments/built-in-proc-name.d.ts +2 -0
  62. package/dataflow/environments/built-in-proc-name.js +2 -0
  63. package/dataflow/environments/built-in.d.ts +2 -0
  64. package/dataflow/environments/built-in.js +2 -0
  65. package/dataflow/environments/default-builtin-config.d.ts +3 -5
  66. package/dataflow/environments/default-builtin-config.js +2 -2
  67. package/dataflow/environments/environment.d.ts +9 -0
  68. package/dataflow/environments/environment.js +28 -7
  69. package/dataflow/environments/identifier.d.ts +1 -2
  70. package/dataflow/environments/identifier.js +1 -5
  71. package/dataflow/extractor.js +1 -2
  72. package/dataflow/graph/dataflowgraph-builder.js +42 -3
  73. package/dataflow/graph/df-helper.d.ts +15 -0
  74. package/dataflow/graph/df-helper.js +20 -0
  75. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +4 -4
  76. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +7 -0
  77. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +13 -0
  78. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +4 -0
  79. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +57 -11
  80. package/dataflow/internal/process/functions/call/built-in/built-in-load.d.ts +12 -0
  81. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +233 -0
  82. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +2 -1
  83. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +5 -3
  84. package/documentation/data/faq/faqs.js +12 -1
  85. package/documentation/doc-readme.js +1 -1
  86. package/documentation/doc-util/doc-files.d.ts +2 -2
  87. package/documentation/doc-util/doc-files.js +4 -7
  88. package/documentation/doc-util/doc-query.d.ts +12 -9
  89. package/documentation/doc-util/doc-query.js +63 -28
  90. package/documentation/wiki-absint.js +1 -4
  91. package/documentation/wiki-analyzer.js +8 -3
  92. package/documentation/wiki-cfg.js +3 -2
  93. package/documentation/wiki-dataflow-graph.js +14 -4
  94. package/documentation/wiki-interface.js +29 -16
  95. package/documentation/wiki-mk/doc-maker.js +1 -1
  96. package/documentation/wiki-query.js +189 -30
  97. package/documentation/wiki-signature-database.d.ts +1 -1
  98. package/documentation/wiki-signature-database.js +53 -27
  99. package/linter/linter-output.d.ts +24 -0
  100. package/linter/linter-output.js +117 -0
  101. package/linter/linter-rules.d.ts +2 -4
  102. package/linter/rules/dataframe-access-validation.js +4 -4
  103. package/linter/rules/deprecated-functions.d.ts +2 -4
  104. package/linter/rules/deprecated-functions.js +58 -3
  105. package/linter/rules/undefined-symbol.js +18 -10
  106. package/linter/rules/unused-definition.js +24 -0
  107. package/package.json +5 -2
  108. package/project/context/flowr-analyzer-context.d.ts +59 -1
  109. package/project/context/flowr-analyzer-context.js +118 -3
  110. package/project/context/flowr-analyzer-dependencies-context.d.ts +32 -7
  111. package/project/context/flowr-analyzer-dependencies-context.js +33 -3
  112. package/project/context/flowr-analyzer-files-context.d.ts +32 -0
  113. package/project/context/flowr-analyzer-files-context.js +132 -14
  114. package/project/context/flowr-analyzer-loading-order-context.d.ts +6 -0
  115. package/project/context/flowr-analyzer-loading-order-context.js +20 -0
  116. package/project/context/flowr-analyzer-meta-context.d.ts +92 -10
  117. package/project/context/flowr-analyzer-meta-context.js +64 -23
  118. package/project/context/flowr-file.d.ts +7 -0
  119. package/project/context/flowr-file.js +7 -0
  120. package/project/context/project-kind.d.ts +22 -0
  121. package/project/context/project-kind.js +27 -0
  122. package/project/dependency-version-space.d.ts +166 -0
  123. package/project/dependency-version-space.js +564 -0
  124. package/project/flowr-analyzer-builder.js +1 -1
  125. package/project/flowr-analyzer.d.ts +4 -0
  126. package/project/flowr-analyzer.js +5 -0
  127. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +4 -0
  128. package/project/plugins/file-plugins/files/flowr-description-file.js +7 -0
  129. package/project/plugins/file-plugins/files/flowr-namespace-file.js +5 -1
  130. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +739 -0
  131. package/project/plugins/file-plugins/files/flowr-rda-file.js +2407 -0
  132. package/project/plugins/file-plugins/files/flowr-rproject-file.d.ts +31 -0
  133. package/project/plugins/file-plugins/files/flowr-rproject-file.js +66 -0
  134. package/project/plugins/file-plugins/files/r-fun-tab.d.ts +828 -0
  135. package/project/plugins/file-plugins/files/r-fun-tab.js +1039 -0
  136. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +1 -1
  137. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +1 -1
  138. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +1 -1
  139. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +1 -1
  140. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +1 -1
  141. package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.d.ts +1 -1
  142. package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.js +1 -1
  143. package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.d.ts +1 -1
  144. package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.js +1 -1
  145. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +1 -1
  146. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +1 -1
  147. package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.d.ts +26 -0
  148. package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.js +38 -0
  149. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.d.ts +17 -0
  150. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +30 -0
  151. package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.d.ts +22 -0
  152. package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.js +36 -0
  153. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.d.ts +1 -1
  154. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +1 -1
  155. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.d.ts +1 -1
  156. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +1 -1
  157. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +3 -4
  158. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +5 -6
  159. package/project/plugins/flowr-analyzer-plugin.js +5 -0
  160. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.d.ts +1 -1
  161. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +1 -1
  162. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin.d.ts +14 -0
  163. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin.js +53 -0
  164. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.js +1 -1
  165. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin.d.ts +15 -0
  166. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin.js +33 -0
  167. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.d.ts +1 -1
  168. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +18 -13
  169. package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.d.ts +13 -0
  170. package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.js +32 -0
  171. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +1 -1
  172. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
  173. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +8 -1
  174. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +70 -7
  175. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.d.ts +1 -1
  176. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -1
  177. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +1 -1
  178. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.d.ts +18 -0
  179. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.js +62 -0
  180. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +4 -1
  181. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +5 -13
  182. package/project/plugins/package-version-plugins/package.d.ts +4 -1
  183. package/project/plugins/package-version-plugins/package.js +8 -5
  184. package/project/plugins/plugin-registry.d.ts +11 -3
  185. package/project/plugins/plugin-registry.js +24 -5
  186. package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.d.ts +51 -0
  187. package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.js +101 -0
  188. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +10 -5
  189. package/project/sigdb/build.js +12 -2
  190. package/project/sigdb/decode.d.ts +7 -0
  191. package/project/sigdb/decode.js +35 -4
  192. package/project/sigdb/decompress.d.ts +2 -0
  193. package/project/sigdb/decompress.js +5 -0
  194. package/project/sigdb/manifest.d.ts +5 -0
  195. package/project/sigdb/manifest.js +37 -6
  196. package/project/sigdb/reader.d.ts +82 -2
  197. package/project/sigdb/reader.js +226 -14
  198. package/project/sigdb/schema.d.ts +31 -5
  199. package/project/sigdb/schema.js +7 -3
  200. package/project/sigdb/{version.d.ts → sigdb-version.d.ts} +21 -1
  201. package/project/sigdb/sigdb-version.js +119 -0
  202. package/queries/catalog/absint-query/absint-query-format.d.ts +2 -0
  203. package/queries/catalog/absint-query/absint-query-format.js +2 -0
  204. package/queries/catalog/call-context-query/call-context-query-executor.js +30 -3
  205. package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -0
  206. package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
  207. package/queries/catalog/call-graph-query/call-graph-query-executor.js +3 -1
  208. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +6 -0
  209. package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -0
  210. package/queries/catalog/call-graph-query/expand-library-internals.d.ts +19 -0
  211. package/queries/catalog/call-graph-query/expand-library-internals.js +59 -0
  212. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -0
  213. package/queries/catalog/cluster-query/cluster-query-format.js +1 -0
  214. package/queries/catalog/config-query/config-query-executor.js +15 -6
  215. package/queries/catalog/config-query/config-query-format.d.ts +18 -4
  216. package/queries/catalog/config-query/config-query-format.js +246 -96
  217. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -0
  218. package/queries/catalog/control-flow-query/control-flow-query-format.js +1 -0
  219. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -0
  220. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -0
  221. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -0
  222. package/queries/catalog/dataflow-query/dataflow-query-format.js +1 -0
  223. package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -7
  224. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +13 -1
  225. package/queries/catalog/dependencies-query/dependencies-query-format.js +117 -17
  226. package/queries/catalog/dice-query/dice-query-executor.js +6 -9
  227. package/queries/catalog/dice-query/dice-query-format.d.ts +4 -5
  228. package/queries/catalog/dice-query/dice-query-format.js +10 -6
  229. package/queries/catalog/does-call-query/does-call-query-executor.js +15 -2
  230. package/queries/catalog/does-call-query/does-call-query-format.d.ts +8 -0
  231. package/queries/catalog/does-call-query/does-call-query-format.js +4 -1
  232. package/queries/catalog/files-query/files-query-format.d.ts +2 -0
  233. package/queries/catalog/files-query/files-query-format.js +2 -0
  234. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.d.ts +6 -0
  235. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +277 -0
  236. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +119 -0
  237. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +331 -0
  238. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -0
  239. package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -0
  240. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -0
  241. package/queries/catalog/id-map-query/id-map-query-format.js +1 -0
  242. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
  243. package/queries/catalog/input-sources-query/input-sources-query-format.js +2 -0
  244. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
  245. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -0
  246. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
  247. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +2 -0
  248. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +2 -0
  249. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +2 -0
  250. package/queries/catalog/linter-query/linter-query-executor.js +11 -2
  251. package/queries/catalog/linter-query/linter-query-format.d.ts +9 -4
  252. package/queries/catalog/linter-query/linter-query-format.js +44 -21
  253. package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
  254. package/queries/catalog/location-map-query/location-map-query-format.js +2 -0
  255. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -0
  256. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -0
  257. package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
  258. package/queries/catalog/origin-query/origin-query-format.js +2 -0
  259. package/queries/catalog/project-query/project-query-executor.d.ts +0 -15
  260. package/queries/catalog/project-query/project-query-executor.js +19 -62
  261. package/queries/catalog/project-query/project-query-format.d.ts +7 -18
  262. package/queries/catalog/project-query/project-query-format.js +3 -18
  263. package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
  264. package/queries/catalog/provenance-query/provenance-query-format.js +2 -0
  265. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
  266. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +2 -0
  267. package/queries/catalog/search-query/search-query-format.d.ts +1 -0
  268. package/queries/catalog/search-query/search-query-format.js +1 -0
  269. package/queries/catalog/signature-query/signature-query-executor.d.ts +5 -0
  270. package/queries/catalog/signature-query/signature-query-executor.js +267 -57
  271. package/queries/catalog/signature-query/signature-query-format.d.ts +37 -6
  272. package/queries/catalog/signature-query/signature-query-format.js +41 -5
  273. package/queries/catalog/signature-query/signature-query-render.js +48 -6
  274. package/queries/catalog/slice-query-options.d.ts +49 -0
  275. package/queries/catalog/slice-query-options.js +50 -0
  276. package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -12
  277. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -15
  278. package/queries/catalog/static-slice-query/static-slice-query-format.js +9 -10
  279. package/queries/query-print.js +3 -1
  280. package/queries/query.d.ts +63 -3
  281. package/queries/query.js +9 -2
  282. package/r-bridge/data/data.d.ts +16 -0
  283. package/r-bridge/data/data.js +20 -0
  284. package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -0
  285. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +2 -1
  286. package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +2 -1
  287. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +19 -16
  288. package/reconstruct/reconstruct.d.ts +18 -1
  289. package/reconstruct/reconstruct.js +42 -19
  290. package/slicing/criterion/parse.d.ts +4 -0
  291. package/slicing/criterion/parse.js +4 -0
  292. package/slicing/static/slice-call.js +17 -9
  293. package/slicing/static/static-slicer.d.ts +1 -1
  294. package/slicing/static/static-slicer.js +5 -4
  295. package/util/files.d.ts +19 -1
  296. package/util/files.js +45 -3
  297. package/util/glob.d.ts +19 -0
  298. package/util/glob.js +67 -0
  299. package/util/log.d.ts +12 -0
  300. package/util/log.js +17 -1
  301. package/util/logic.d.ts +6 -0
  302. package/util/logic.js +31 -1
  303. package/util/mermaid/dfg.js +17 -12
  304. package/util/mermaid/mermaid.js +2 -2
  305. package/util/objects.d.ts +5 -0
  306. package/util/objects.js +8 -0
  307. package/util/r-version.d.ts +9 -1
  308. package/util/r-version.js +27 -2
  309. package/util/schema.d.ts +16 -0
  310. package/util/schema.js +89 -4
  311. package/util/text/ansi.d.ts +4 -0
  312. package/util/text/ansi.js +27 -3
  313. package/util/text/strings.d.ts +9 -0
  314. package/util/text/strings.js +29 -0
  315. package/util/version.js +79 -6
  316. package/abstract-interpretation/domains/satisfiable-domain.d.ts +0 -29
  317. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +0 -22
  318. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +0 -52
  319. package/project/sigdb/version.js +0 -55
@@ -1,7 +1,4 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.queryStarCommand = exports.queryCommand = void 0;
7
4
  exports.validateQueries = validateQueries;
@@ -13,19 +10,7 @@ const json_1 = require("../../../util/json");
13
10
  const args_1 = require("../../../util/text/args");
14
11
  const record_1 = require("../../../util/record");
15
12
  const retriever_1 = require("../../../r-bridge/retriever");
16
- const core_1 = require("../core");
17
- const fs_1 = __importDefault(require("fs"));
18
- /** Whether `s` looks like a filesystem path the user likely meant to load via {@link fileProtocol}. */
19
- function looksLikePath(s) {
20
- if (s.startsWith(retriever_1.fileProtocol) || s.startsWith(core_1.watchProtocol)) {
21
- return false;
22
- }
23
- if (/^(~|\.{0,2}\/|[a-zA-Z]:[\\/])/.test(s)) {
24
- return true;
25
- }
26
- // a single path-like token (a separator, no R-code punctuation) that actually exists on disk
27
- return /^[^\s()]+\/[^\s()]+$/.test(s) && fs_1.default.existsSync(s);
28
- }
13
+ const path_input_1 = require("../path-input");
29
14
  /**
30
15
  * Whether the analyzer already holds exactly `input` as its sole request, so a prior analysis (e.g. a
31
16
  * dataflow computed via `:df#`) can be reused instead of being discarded by a reset.
@@ -38,15 +23,49 @@ function analyzerHasTarget(analyzer, input) {
38
23
  function printHelp(output) {
39
24
  output.stderr(`Format: ${(0, ansi_1.italic)(':query <query> <code>', output.formatter)}`);
40
25
  output.stdout('Queries starting with \'@<type>\' are interpreted as a query of the given type.');
26
+ output.stdout(`Start with '?<type>' instead to see documentation on a query, e.g. ${(0, ansi_1.bold)(':query ?guess-dep-versions', output.formatter)} (a bare ${(0, ansi_1.bold)(':query ?', output.formatter)} lists them all).`);
41
27
  output.stdout(`With this, ${(0, ansi_1.bold)(':query @config', output.formatter)} prints the result of the config query.`);
42
28
  output.stdout(`If you want to run the linter on a project use:\n ${(0, ansi_1.bold)(':query @linter file://<path>', output.formatter)} (or ${(0, ansi_1.bold)('watch://<path>', output.formatter)} to re-run on changes).`);
43
29
  output.stdout((0, ansi_1.ansiInfo)('Otherwise, you can also directly pass the query json. Then, the query is an array of query objects to represent multiple queries.'));
44
30
  output.stdout((0, ansi_1.ansiInfo)('The example') + (0, ansi_1.italic)(String.raw `:query "[{\"type\": \"call-context\", \"callName\": \"mean\" }]" mean(1:10)`, output.formatter, { color: 7 /* Colors.White */, effect: ansi_1.ColorEffect.Foreground }) + (0, ansi_1.ansiInfo)('would return the call context of the mean function.'));
45
31
  output.stdout('Please have a look at the wiki for more info: https://github.com/flowr-analysis/flowr/wiki/Query-API');
46
32
  }
33
+ /** the single boundary cast for Joi's untyped {@link Joi.Description}, shared by the doc and template renderers */
34
+ function describeSchema(schema) {
35
+ return schema.describe();
36
+ }
37
+ /** Print documentation for one query type from its Joi schema (description + each parameter), or list all when no name is given. */
38
+ function printQueryDoc(output, name) {
39
+ if (name.length === 0) {
40
+ output.stdout(`Queries: ${Object.keys(query_1.SupportedQueries).sort().map(q => (0, ansi_1.bold)('@' + q, output.formatter)).join(', ')}`);
41
+ output.stdout(`Use ${(0, ansi_1.bold)(':query ?<type>', output.formatter)} for details on one, e.g. ${(0, ansi_1.bold)(':query ?guess-dep-versions', output.formatter)}.`);
42
+ return;
43
+ }
44
+ const def = Object.entries(query_1.SupportedQueries).find(([key]) => key === name)?.[1];
45
+ if (def === undefined) {
46
+ output.stderr(`Unknown query ${(0, ansi_1.italic)(name, output.formatter)}; use ${(0, ansi_1.bold)(':query ?', output.formatter)} to list every query.`);
47
+ return;
48
+ }
49
+ const desc = describeSchema(def.schema);
50
+ output.stdout(`${(0, ansi_1.bold)('@' + name, output.formatter)}${desc.flags?.description ? ` ${(0, ansi_1.faint)('— ' + desc.flags.description, output.formatter)}` : ''}`);
51
+ const params = Object.entries(desc.keys ?? {}).filter(([key]) => key !== 'type');
52
+ if (params.length === 0) {
53
+ output.stdout((0, ansi_1.faint)(' (no parameters)', output.formatter));
54
+ }
55
+ for (const [key, spec] of params) {
56
+ const presence = spec.flags?.presence === 'required' ? 'required' : 'optional';
57
+ const allowed = Array.isArray(spec.allow) && spec.allow.length > 0 ? ` {${spec.allow.join('|')}}` : '';
58
+ output.stdout(` ${(0, ansi_1.bold)(key, output.formatter)} ${(0, ansi_1.faint)(`(${spec.type}${allowed}, ${presence})`, output.formatter)}${spec.flags?.description ? ': ' + spec.flags.description : ''}`);
59
+ }
60
+ const syntax = 'syntax' in def && typeof def.syntax === 'string' ? def.syntax : `@${name} <code | file://path>`;
61
+ output.stdout(`Run: ${(0, ansi_1.bold)(':query ' + syntax, output.formatter)}`);
62
+ output.stdout(`JSON: ${(0, ansi_1.italic)(queryTemplate(name, def.schema), output.formatter)}`);
63
+ const wiki = `https://github.com/flowr-analysis/flowr/wiki/${encodeURIComponent((0, query_1.queryWikiPage)(def.title).replaceAll(' ', '-'))}`;
64
+ output.stdout(`Docs: ${(0, ansi_1.supportsHyperlinks)() ? output.formatter.hyperlink(`${name} query`, wiki) : wiki}`);
65
+ }
47
66
  /** A copy-pasteable JSON template for a query type: its `type` plus each required field as a placeholder. */
48
67
  function queryTemplate(type, schema) {
49
- const keys = schema.describe().keys ?? {};
68
+ const keys = describeSchema(schema).keys ?? {};
50
69
  const fields = [`\\"type\\": \\"${type}\\"`];
51
70
  for (const [key, value] of Object.entries(keys)) {
52
71
  if (key !== 'type' && value.flags?.presence === 'required') {
@@ -88,6 +107,11 @@ async function processQueryArgs(output, analyzer, remainingArgs) {
88
107
  printHelp(output);
89
108
  return;
90
109
  }
110
+ // `?<type>` (or `? <type>`) documents a query instead of running it; a bare `?` lists them all
111
+ if (query.startsWith('?')) {
112
+ printQueryDoc(output, query.slice(1) || (remainingArgs.shift() ?? ''));
113
+ return;
114
+ }
91
115
  let parsedQuery;
92
116
  let input;
93
117
  if (query.startsWith('@')) {
@@ -118,9 +142,7 @@ async function processQueryArgs(output, analyzer, remainingArgs) {
118
142
  parsedQuery = [{ type: 'call-context', callName: query }];
119
143
  }
120
144
  if (input) {
121
- if (looksLikePath(input)) {
122
- output.stdout((0, ansi_1.ansiInfo)(`'${input}' looks like a path. To analyze it, use ${(0, ansi_1.bold)(retriever_1.fileProtocol + input, output.formatter)} (or ${(0, ansi_1.bold)(core_1.watchProtocol + input, output.formatter)} to re-run on changes). Use ${(0, ansi_1.bold)(':help', output.formatter)} for more.`));
123
- }
145
+ input = (0, path_input_1.handlePathLikeInput)(output, input, analyzer.flowrConfig);
124
146
  // reuse a prior analysis (e.g. a dataflow from :df#) when the target is unchanged
125
147
  if (!analyzerHasTarget(analyzer, input)) {
126
148
  analyzer.reset();
@@ -22,8 +22,8 @@ function printHelp(output) {
22
22
  const f = output.formatter;
23
23
  output.stdout((0, ansi_1.bold)('Signature Database', f) + (0, ansi_1.italic)(' (inspect and extend the databases that resolve library()/`::` calls)', f));
24
24
  output.stdout('');
25
- output.stdout(` ${(0, ansi_1.bold)(':signature query', f)} ${(0, ansi_1.italic)('[<package>[@<version>][::<function>] [<function>]] [--all] [--full]', f)}`);
26
- output.stdout(` ${(0, ansi_1.italic)('inspect the database -- identical to :query @signature (run :signature query help for the full syntax)', f)}`);
25
+ output.stdout(` ${(0, ansi_1.bold)(':signature query', f)} ${(0, ansi_1.italic)('[<package>[@<version>][::<function>] [<function>]] [--param <name>] [--required <n>]', f)}`);
26
+ output.stdout(` ${(0, ansi_1.italic)('inspect the database -- identical to :query @signature; with no package it summarizes the loaded databases and per-shard load state (run :signature query help for the full syntax)', f)}`);
27
27
  output.stdout(` ${(0, ansi_1.bold)(':signature add', f)} ${(0, ansi_1.italic)('<path-to-.sigs.ndjson|.br|.manifest.json>', f)}`);
28
28
  output.stdout(` ${(0, ansi_1.italic)('mount an additional signature database/source (dictionaries + shards); takes precedence over the bundle', f)}`);
29
29
  output.stdout(` ${(0, ansi_1.bold)(':signature download', f)} ${(0, ansi_1.italic)('[<version>]', f)}`);
@@ -15,7 +15,18 @@ export interface CommandCompletions {
15
15
  * This is relevant if an argument is composed of multiple parts (e.g. comma-separated lists).
16
16
  */
17
17
  readonly argumentPart?: string;
18
+ /** What Tab displays per completion, only used while several remain: readline inserts what it displays. */
19
+ readonly labels?: ReadonlyMap<string, string>;
20
+ /** Display-only suggestions (e.g. a `<string>` type placeholder): previewed as a ghost hint but never inserted on Tab. */
21
+ readonly hints?: readonly string[];
22
+ /**
23
+ * The completer already selected these, so they must not be filtered against the typed fragment again.
24
+ * Needed when a completion legitimately shares no prefix with what was typed, e.g. a glob expanding to the keys it matches.
25
+ */
26
+ readonly preFiltered?: boolean;
18
27
  }
28
+ /** Labels a completion with what it does, see {@link CommandCompletions#labels|labels}. */
29
+ export declare function describeCompletion(insert: string, describe: string): string;
19
30
  /**
20
31
  * Used by the repl to provide automatic completions for a given (partial) input line. Returns every matching
21
32
  * option, so Tab shows the full menu and only completes when a single option remains (standard readline behavior).
@@ -30,7 +41,7 @@ export declare function completionSuggestion(line: string, config: FlowrConfig):
30
41
  /**
31
42
  * Produces default readline options for the flowR REPL
32
43
  */
33
- export declare function makeDefaultReplReadline(config: FlowrConfig): readline.ReadLineOptions;
44
+ export declare function makeDefaultReplReadline(config: FlowrConfig, historyFile?: string | undefined): readline.ReadLineOptions;
34
45
  /**
35
46
  * Handles a string input for the REPL, returning the parsed string and any remaining input.
36
47
  */
@@ -38,8 +49,6 @@ export declare function handleString(code: string): {
38
49
  rCode: string | undefined;
39
50
  remaining: never[];
40
51
  };
41
- /** Path prefix that activates watch mode; use instead of {@link fileProtocol} to re-run on every file change. */
42
- export declare const watchProtocol = "watch://";
43
52
  /** Convert a statement containing {@link watchProtocol} into one using {@link fileProtocol} so it can be executed. */
44
53
  export declare function toFileStatement(statement: string): string;
45
54
  /** Return the watch path from the first `watch://<path>` token in `statement`, or `undefined` if none is present. */
@@ -71,7 +80,7 @@ export interface FlowrReplOptions extends MergeableRecord {
71
80
  readonly rl?: readline.Interface;
72
81
  /** Defines two methods that every function in the repl uses to output its data. */
73
82
  readonly output?: ReplOutput;
74
- /** The file to use for persisting the repl's history. Passing undefined causes history not to be saved. */
83
+ /** The file to use for loading and persisting the repl's history. Passing an empty string neither reads nor writes it. */
75
84
  readonly historyFile?: string;
76
85
  /** If true, allows the execution of arbitrary R code. This is a security risk, as it allows the execution of arbitrary R code. */
77
86
  readonly allowRSessionAccess?: boolean;
@@ -86,7 +95,7 @@ export interface FlowrReplOptions extends MergeableRecord {
86
95
  *
87
96
  * For the execution, this function makes use of {@link replProcessAnswer}.
88
97
  */
89
- export declare function repl({ analyzer, rl, output, historyFile, allowRSessionAccess }: FlowrReplOptions): Promise<void>;
98
+ export declare function repl({ analyzer, historyFile, rl, output, allowRSessionAccess }: FlowrReplOptions): Promise<void>;
90
99
  /**
91
100
  * Loads the REPL history from the given file.
92
101
  */
package/cli/repl/core.js CHANGED
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.watchProtocol = void 0;
39
+ exports.describeCompletion = describeCompletion;
40
40
  exports.replCompleter = replCompleter;
41
41
  exports.completionSuggestion = completionSuggestion;
42
42
  exports.makeDefaultReplReadline = makeDefaultReplReadline;
@@ -53,6 +53,7 @@ exports.loadReplHistory = loadReplHistory;
53
53
  * @module
54
54
  */
55
55
  const prompt_1 = require("./prompt");
56
+ const path_input_1 = require("./path-input");
56
57
  const readline = __importStar(require("readline"));
57
58
  const ghost_hint_1 = require("./ghost-hint");
58
59
  const repl_execute_1 = require("./commands/repl-execute");
@@ -79,6 +80,10 @@ function replCompleterKeywords() {
79
80
  return _replCompleterKeywords;
80
81
  }
81
82
  const defaultHistoryFile = path_1.default.join(os_1.default.tmpdir(), '.flowrhistory');
83
+ /** Labels a completion with what it does, see {@link CommandCompletions#labels|labels}. */
84
+ function describeCompletion(insert, describe) {
85
+ return `${insert} ${ansi_1.ansiFormatter.format(describe, { style: 2 /* FontStyles.Faint */ })}`;
86
+ }
82
87
  function computeCompletions(line, config) {
83
88
  const splitLine = (0, args_1.splitAtEscapeSensitive)(line);
84
89
  // did we just type a space (and are starting a new arg right now)?
@@ -89,6 +94,9 @@ function computeCompletions(line, config) {
89
94
  if (commandNameColon) {
90
95
  let completions = [];
91
96
  let currentArg = startingNewArg ? '' : splitLine[splitLine.length - 1];
97
+ let labels;
98
+ let hints;
99
+ let preFiltered = false;
92
100
  const commandName = commandNameColon.slice(1);
93
101
  const cmd = (0, repl_commands_1.getCommand)(commandName);
94
102
  if (cmd?.script === true) {
@@ -97,11 +105,14 @@ function computeCompletions(line, config) {
97
105
  completions = completions.concat((0, scripts_info_1.getValidOptionsForCompletion)(options, splitLine).map(o => `${o} `));
98
106
  }
99
107
  else if (commandName.startsWith('query')) {
100
- const { completions: queryCompletions, argumentPart: splitArg } = replQueryCompleter(splitLine, startingNewArg, config);
108
+ const { completions: queryCompletions, argumentPart: splitArg, labels: queryLabels, hints: queryHints, preFiltered: queryPreFiltered } = replQueryCompleter(splitLine, startingNewArg, config);
101
109
  if (splitArg !== undefined) {
102
110
  currentArg = splitArg;
103
111
  }
104
112
  completions = completions.concat(queryCompletions);
113
+ labels = queryLabels;
114
+ hints = queryHints;
115
+ preFiltered = queryPreFiltered ?? false;
105
116
  }
106
117
  else if (cmd === repl_signature_1.signatureCommand) {
107
118
  const { completions: sigCompletions, argumentPart: splitArg } = (0, repl_signature_1.replSignatureCompleter)(splitLine, startingNewArg);
@@ -112,9 +123,10 @@ function computeCompletions(line, config) {
112
123
  }
113
124
  else if (cmd?.isCodeCommand) {
114
125
  completions.push(retriever_1.fileProtocol);
115
- completions.push(exports.watchProtocol);
126
+ completions.push(path_input_1.watchProtocol);
116
127
  }
117
- return [completions.filter(a => a.startsWith(currentArg)), currentArg];
128
+ // prefix matches when any exist, else fuzzy (subsequence) matches, so e.g. `+sg` still completes to `+specializeConfig`
129
+ return [preFiltered ? completions : (0, strings_1.matchByPrefixOrSubsequence)(completions, currentArg), currentArg, labels, hints?.filter(h => h.startsWith(currentArg))];
118
130
  }
119
131
  }
120
132
  // if no command is already typed, just return all commands that match
@@ -125,7 +137,11 @@ function computeCompletions(line, config) {
125
137
  * option, so Tab shows the full menu and only completes when a single option remains (standard readline behavior).
126
138
  */
127
139
  function replCompleter(line, config) {
128
- return computeCompletions(line, config);
140
+ const [completions, fragment, labels] = computeCompletions(line, config);
141
+ if (labels === undefined || completions.length <= 1) {
142
+ return [completions, fragment];
143
+ }
144
+ return [completions.map(c => labels.get(c) ?? c), fragment];
129
145
  }
130
146
  /**
131
147
  * The remaining text of the best (first) completion, i.e. what the inline ghost previews as you type; empty when
@@ -136,12 +152,13 @@ function completionSuggestion(line, config) {
136
152
  if (line.length === 0) {
137
153
  return '';
138
154
  }
139
- const [completions, fragment] = computeCompletions(line, config);
140
- const best = completions[0];
155
+ const [completions, fragment, , hints] = computeCompletions(line, config);
156
+ // prefer an insertable completion; otherwise preview a display-only hint (e.g. a `<string>` type placeholder)
157
+ const best = completions[0] ?? hints?.[0];
141
158
  if (best === undefined || !best.startsWith(fragment) || best.length <= fragment.length) {
142
159
  return '';
143
160
  }
144
- else if (best === retriever_1.fileProtocol || best === exports.watchProtocol) {
161
+ else if (best === retriever_1.fileProtocol || best === path_input_1.watchProtocol) {
145
162
  return '';
146
163
  }
147
164
  return best.slice(fragment.length);
@@ -164,13 +181,13 @@ function replQueryCompleter(splitLine, startingNewArg, config) {
164
181
  /**
165
182
  * Produces default readline options for the flowR REPL
166
183
  */
167
- function makeDefaultReplReadline(config) {
184
+ function makeDefaultReplReadline(config, historyFile = defaultHistoryFile) {
168
185
  return {
169
186
  input: process.stdin,
170
187
  output: process.stdout,
171
188
  tabSize: 4,
172
189
  terminal: true,
173
- history: loadReplHistory(defaultHistoryFile),
190
+ history: historyFile ? loadReplHistory(historyFile) : [],
174
191
  removeHistoryDuplicates: true,
175
192
  completer: (c) => replCompleter(c, config)
176
193
  };
@@ -184,11 +201,9 @@ function handleString(code) {
184
201
  remaining: []
185
202
  };
186
203
  }
187
- /** Path prefix that activates watch mode; use instead of {@link fileProtocol} to re-run on every file change. */
188
- exports.watchProtocol = 'watch://';
189
204
  /** Convert a statement containing {@link watchProtocol} into one using {@link fileProtocol} so it can be executed. */
190
205
  function toFileStatement(statement) {
191
- return statement.replaceAll(exports.watchProtocol, retriever_1.fileProtocol);
206
+ return statement.replaceAll(path_input_1.watchProtocol, retriever_1.fileProtocol);
192
207
  }
193
208
  /** Return the watch path from the first `watch://<path>` token in `statement`, or `undefined` if none is present. */
194
209
  function extractWatchPath(statement) {
@@ -241,7 +256,7 @@ async function executeStatement(output, statement, analyzer, allowRSessionAccess
241
256
  const args = processor.argsParser(remainingLine);
242
257
  if (args.rCode) {
243
258
  analyzer.reset();
244
- analyzer.addRequest(args.rCode);
259
+ analyzer.addRequest((0, path_input_1.handlePathLikeInput)(output, args.rCode, analyzer.flowrConfig));
245
260
  }
246
261
  await processor.fn({ output, analyzer, remainingArgs: args.remaining });
247
262
  }
@@ -303,8 +318,8 @@ async function executeStatement(output, statement, analyzer, allowRSessionAccess
303
318
  }
304
319
  }
305
320
  async function replProcessStatement(output, statement, analyzer, allowRSessionAccess) {
306
- stopWatching(output, !statement.includes(exports.watchProtocol));
307
- if (statement.includes(exports.watchProtocol)) {
321
+ stopWatching(output, !statement.includes(path_input_1.watchProtocol));
322
+ if (statement.includes(path_input_1.watchProtocol)) {
308
323
  const watchPath = extractWatchPath(statement);
309
324
  const effective = toFileStatement(statement);
310
325
  await executeStatement(output, effective, analyzer, allowRSessionAccess);
@@ -350,7 +365,7 @@ async function replProcessAnswer(analyzer, output, expr, allowRSessionAccess) {
350
365
  *
351
366
  * For the execution, this function makes use of {@link replProcessAnswer}.
352
367
  */
353
- async function repl({ analyzer, rl = readline.createInterface(makeDefaultReplReadline(analyzer.flowrConfig)), output = repl_main_1.standardReplOutput, historyFile = defaultHistoryFile, allowRSessionAccess = false }) {
368
+ async function repl({ analyzer, historyFile = defaultHistoryFile, rl = readline.createInterface(makeDefaultReplReadline(analyzer.flowrConfig, historyFile)), output = repl_main_1.standardReplOutput, allowRSessionAccess = false }) {
354
369
  if (historyFile) {
355
370
  rl.on('history', h => fs_1.default.writeFileSync(historyFile, h.join('\n'), { encoding: 'utf-8' }));
356
371
  }
@@ -1,21 +1,77 @@
1
1
  import type { SlicingCriterion, SlicingCriteria } from '../../../slicing/criterion/parse';
2
2
  import { SliceDirection } from '../../../util/slice-direction';
3
- import type { CommandCompletions } from '../core';
3
+ import { type CommandCompletions } from '../core';
4
4
  import type { FlowrConfig } from '../../../config';
5
+ import type { SliceQueryOptions } from '../../../queries/catalog/slice-query-options';
6
+ import type { ReplOutput } from '../commands/repl-main';
7
+ /** A flag that may follow the closing bracket of a criteria argument. */
8
+ export interface SliceFlag {
9
+ readonly flag: string;
10
+ /** what the flag does, kept to a few words as it is offered as a completion */
11
+ readonly describe: string;
12
+ /** the flag this one only makes sense with, if any */
13
+ readonly requires?: string;
14
+ /** the flags this one must not be combined with */
15
+ readonly conflicts?: readonly string[];
16
+ }
17
+ /** the flags every slicing query understands, see {@link sliceQueryOptionsParser} */
18
+ export declare const SharedSliceFlags: readonly [{
19
+ readonly flag: "i";
20
+ readonly describe: "inline sources";
21
+ readonly conflicts: readonly ["I"];
22
+ }, {
23
+ readonly flag: "c";
24
+ readonly describe: "include callees";
25
+ }, {
26
+ readonly flag: "I";
27
+ readonly describe: "inline all files";
28
+ readonly conflicts: readonly ["i"];
29
+ }, {
30
+ readonly flag: "B";
31
+ readonly describe: "banners";
32
+ readonly requires: "I";
33
+ }];
34
+ /** the flags of the `static-slice` query: a dice fixes both directions, so only it can be told to slice forward */
35
+ export declare const StaticSliceFlags: readonly [{
36
+ readonly flag: "f";
37
+ readonly describe: "slice forward";
38
+ }, {
39
+ readonly flag: "i";
40
+ readonly describe: "inline sources";
41
+ readonly conflicts: readonly ["I"];
42
+ }, {
43
+ readonly flag: "c";
44
+ readonly describe: "include callees";
45
+ }, {
46
+ readonly flag: "I";
47
+ readonly describe: "inline all files";
48
+ readonly conflicts: readonly ["i"];
49
+ }, {
50
+ readonly flag: "B";
51
+ readonly describe: "banners";
52
+ readonly requires: "I";
53
+ }];
5
54
  /**
6
55
  * Checks whether the given argument represents a slicing direction with an `f` suffix (in any flag order).
7
56
  */
8
57
  export declare function sliceDirectionParser(argument: string): SliceDirection;
9
58
  /**
10
- * Whether the argument requests inline slicing via an `i` suffix (e.g. `(12@x)i`, `(12@x)fi`), which inlines
11
- * resolvable `source()` calls into the reconstruction so the slice is a single self-contained R text.
59
+ * The {@link SliceQueryOptions} the flag suffix of `argument` requests, see {@link SharedSliceFlags}.
60
+ * An absent flag is left out entirely, so the default of the query applies.
12
61
  */
13
- export declare function sliceInlineParser(argument: string): boolean;
62
+ export declare function sliceQueryOptionsParser(argument: string): SliceQueryOptions;
63
+ /** the given flags and what they do, e.g. for a help text: `f (slice forward), B (banners, needs I)` */
64
+ export declare function describeSliceFlags(flags: readonly SliceFlag[]): string;
14
65
  /**
15
- * Whether the argument requests to slice past function-definition boundaries via a `c` suffix
16
- * (e.g. `(12@x)c`, `(12@x)ic`), including the definition's binding and call sites in a backward slice.
66
+ * Warns about the flags of `argument` that `flags` does not know (a `f` on a dice, a typo, ...) or that
67
+ * {@link SliceFlag#conflicts|conflict} with each other, as they are applied silently otherwise.
17
68
  */
18
- export declare function sliceIncludeCalleesParser(argument: string): boolean;
69
+ export declare function warnAboutSliceFlags(output: ReplOutput, argument: string, flags: readonly SliceFlag[]): void;
70
+ /**
71
+ * The R code of a query line, i.e. everything after the argument at `from`. The line is split at whitespace, so
72
+ * unquoted code arrives as several parts and only re-joining them yields all of it.
73
+ */
74
+ export declare function queryLineCode(line: readonly string[], from?: number): string | undefined;
19
75
  /**
20
76
  * Parses a single slicing criterion from the given argument.
21
77
  */
@@ -24,9 +80,14 @@ export declare function sliceCriterionParser(argument: string | undefined): Slic
24
80
  * Parses multiple slicing criteria from the given argument.
25
81
  */
26
82
  export declare function sliceCriteriaParser(argument: string | undefined): SlicingCriteria | undefined;
83
+ /**
84
+ * The completions for the flag suffix of `arg`: every flag that fits the ones it carries already, plus a
85
+ * trailing space to move on to the code. Returns `undefined` while the criteria are still open.
86
+ */
87
+ export declare function sliceFlagCompletions(arg: string, flags: readonly SliceFlag[]): CommandCompletions | undefined;
27
88
  /**
28
89
  * Tab-completer for query arguments of the form `(line@var;line@var;...)`.
29
- * Guides the user step by step: `(` then digits then `@` then variable then `)`.
90
+ * Guides the user step by step: `(` then digits then `@` then variable then `)`, then the flags.
30
91
  */
31
92
  export declare function criteriaQueryCompleter(line: readonly string[], startingNewArg: boolean, _config: FlowrConfig): CommandCompletions;
32
93
  /**
@@ -1,13 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StaticSliceFlags = exports.SharedSliceFlags = void 0;
3
4
  exports.sliceDirectionParser = sliceDirectionParser;
4
- exports.sliceInlineParser = sliceInlineParser;
5
- exports.sliceIncludeCalleesParser = sliceIncludeCalleesParser;
5
+ exports.sliceQueryOptionsParser = sliceQueryOptionsParser;
6
+ exports.describeSliceFlags = describeSliceFlags;
7
+ exports.warnAboutSliceFlags = warnAboutSliceFlags;
8
+ exports.queryLineCode = queryLineCode;
6
9
  exports.sliceCriterionParser = sliceCriterionParser;
7
10
  exports.sliceCriteriaParser = sliceCriteriaParser;
11
+ exports.sliceFlagCompletions = sliceFlagCompletions;
8
12
  exports.criteriaQueryCompleter = criteriaQueryCompleter;
9
13
  exports.diceCriteriaParser = diceCriteriaParser;
10
14
  const slice_direction_1 = require("../../../util/slice-direction");
15
+ const core_1 = require("../core");
16
+ const ansi_1 = require("../../../util/text/ansi");
11
17
  /**
12
18
  * Splits `(criteria)flags` into its two parts, matching the closing bracket by depth: a criterion may well
13
19
  * carry brackets of its own (the `(file-regex)` suffix of e.g. `2@x(tmp/.*)`), so the first `)` is not it.
@@ -31,6 +37,15 @@ function splitCriteriaArgument(argument) {
31
37
  function sliceFlagSuffix(argument) {
32
38
  return splitCriteriaArgument(argument)?.flags ?? '';
33
39
  }
40
+ /** the flags every slicing query understands, see {@link sliceQueryOptionsParser} */
41
+ exports.SharedSliceFlags = [
42
+ { flag: 'i', describe: 'inline sources', conflicts: ['I'] },
43
+ { flag: 'c', describe: 'include callees' },
44
+ { flag: 'I', describe: 'inline all files', conflicts: ['i'] },
45
+ { flag: 'B', describe: 'banners', requires: 'I' }
46
+ ];
47
+ /** the flags of the `static-slice` query: a dice fixes both directions, so only it can be told to slice forward */
48
+ exports.StaticSliceFlags = [{ flag: 'f', describe: 'slice forward' }, ...exports.SharedSliceFlags];
34
49
  /**
35
50
  * Checks whether the given argument represents a slicing direction with an `f` suffix (in any flag order).
36
51
  */
@@ -38,18 +53,49 @@ function sliceDirectionParser(argument) {
38
53
  return sliceFlagSuffix(argument).includes('f') ? slice_direction_1.SliceDirection.Forward : slice_direction_1.SliceDirection.Backward;
39
54
  }
40
55
  /**
41
- * Whether the argument requests inline slicing via an `i` suffix (e.g. `(12@x)i`, `(12@x)fi`), which inlines
42
- * resolvable `source()` calls into the reconstruction so the slice is a single self-contained R text.
56
+ * The {@link SliceQueryOptions} the flag suffix of `argument` requests, see {@link SharedSliceFlags}.
57
+ * An absent flag is left out entirely, so the default of the query applies.
43
58
  */
44
- function sliceInlineParser(argument) {
45
- return sliceFlagSuffix(argument).includes('i');
59
+ function sliceQueryOptionsParser(argument) {
60
+ const flags = sliceFlagSuffix(argument);
61
+ return {
62
+ ...(flags.includes('i') ? { inlineSources: true } : {}),
63
+ ...(flags.includes('I') ? { inlineFull: flags.includes('B') ? 'banner' : true } : {}),
64
+ ...(flags.includes('c') ? { includeCallees: true } : {})
65
+ };
66
+ }
67
+ /** the given flags and what they do, e.g. for a help text: `f (slice forward), B (banners, needs I)` */
68
+ function describeSliceFlags(flags) {
69
+ return flags.map(f => `${f.flag} (${f.describe}${f.requires ? `, needs ${f.requires}` : ''})`).join(', ');
70
+ }
71
+ function warn(output, message) {
72
+ output.stderr(output.formatter.format(message, { color: 3 /* Colors.Yellow */, effect: ansi_1.ColorEffect.Foreground }));
73
+ }
74
+ /**
75
+ * Warns about the flags of `argument` that `flags` does not know (a `f` on a dice, a typo, ...) or that
76
+ * {@link SliceFlag#conflicts|conflict} with each other, as they are applied silently otherwise.
77
+ */
78
+ function warnAboutSliceFlags(output, argument, flags) {
79
+ const given = [...new Set([...sliceFlagSuffix(argument)])];
80
+ const known = new Map(flags.map(f => [f.flag, f]));
81
+ const unknown = given.filter(f => !known.has(f));
82
+ if (unknown.length > 0) {
83
+ warn(output, `Ignoring unknown flag${unknown.length > 1 ? 's' : ''} ${unknown.map(f => `'${f}'`).join(', ')}. Known flags: ${describeSliceFlags(flags)}.`);
84
+ }
85
+ for (const [i, f] of given.entries()) {
86
+ const clash = known.get(f)?.conflicts?.filter(c => given.indexOf(c) > i) ?? [];
87
+ if (clash.length > 0) {
88
+ warn(output, `The flag '${f}' cannot be combined with ${clash.map(c => `'${c}'`).join(', ')}, the latter wins.`);
89
+ }
90
+ }
46
91
  }
47
92
  /**
48
- * Whether the argument requests to slice past function-definition boundaries via a `c` suffix
49
- * (e.g. `(12@x)c`, `(12@x)ic`), including the definition's binding and call sites in a backward slice.
93
+ * The R code of a query line, i.e. everything after the argument at `from`. The line is split at whitespace, so
94
+ * unquoted code arrives as several parts and only re-joining them yields all of it.
50
95
  */
51
- function sliceIncludeCalleesParser(argument) {
52
- return sliceFlagSuffix(argument).includes('c');
96
+ function queryLineCode(line, from = 1) {
97
+ const code = line.slice(from).join(' ').trim();
98
+ return code.length > 0 ? code : undefined;
53
99
  }
54
100
  /**
55
101
  * Parses a single slicing criterion from the given argument.
@@ -67,9 +113,31 @@ function sliceCriteriaParser(argument) {
67
113
  function lastCriterionFragment(arg) {
68
114
  return arg.slice(Math.max(arg.indexOf('(') + 1, arg.lastIndexOf(';') + 1));
69
115
  }
116
+ /**
117
+ * The completions for the flag suffix of `arg`: every flag that fits the ones it carries already, plus a
118
+ * trailing space to move on to the code. Returns `undefined` while the criteria are still open.
119
+ */
120
+ function sliceFlagCompletions(arg, flags) {
121
+ const split = splitCriteriaArgument(arg);
122
+ if (!split) {
123
+ return undefined;
124
+ }
125
+ const has = (flag) => split.flags.includes(flag);
126
+ const offered = flags.filter(f => !has(f.flag)
127
+ && (f.requires === undefined || has(f.requires))
128
+ && !f.conflicts?.some(has));
129
+ return {
130
+ completions: [...offered.map(f => arg + f.flag), arg + ' '],
131
+ labels: new Map([
132
+ ...offered.map(f => [arg + f.flag, (0, core_1.describeCompletion)(f.flag, f.describe)]),
133
+ [arg + ' ', (0, core_1.describeCompletion)('<space>', 'then the code')]
134
+ ]),
135
+ argumentPart: arg
136
+ };
137
+ }
70
138
  /**
71
139
  * Tab-completer for query arguments of the form `(line@var;line@var;...)`.
72
- * Guides the user step by step: `(` then digits then `@` then variable then `)`.
140
+ * Guides the user step by step: `(` then digits then `@` then variable then `)`, then the flags.
73
141
  */
74
142
  function criteriaQueryCompleter(line, startingNewArg, _config) {
75
143
  if (line.length === 0) {
@@ -79,8 +147,9 @@ function criteriaQueryCompleter(line, startingNewArg, _config) {
79
147
  return { completions: [] };
80
148
  }
81
149
  const arg = line[0];
82
- if (arg.endsWith(')') || arg.endsWith(')f')) {
83
- return { completions: [] };
150
+ const flags = sliceFlagCompletions(arg, exports.StaticSliceFlags);
151
+ if (flags) {
152
+ return flags;
84
153
  }
85
154
  const fragment = lastCriterionFragment(arg);
86
155
  if (/^\d+$/.test(fragment)) {
@@ -0,0 +1,6 @@
1
+ import type { FlowrConfig } from '../../config';
2
+ import type { ReplOutput } from './commands/repl-main';
3
+ /** Prefix of an input that is to be re-analyzed whenever the file changes, the counterpart of {@link fileProtocol}. */
4
+ export declare const watchProtocol = "watch://";
5
+ /** The input to analyze: one that looks like a path gets the {@link fileProtocol}, unless the repl config says not to. */
6
+ export declare function handlePathLikeInput(output: ReplOutput, input: string, config: FlowrConfig): string;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.watchProtocol = void 0;
7
+ exports.handlePathLikeInput = handlePathLikeInput;
8
+ /**
9
+ * Handling of repl inputs that name a file, shared by every command that takes R code.
10
+ * @module
11
+ */
12
+ const fs_1 = __importDefault(require("fs"));
13
+ const retriever_1 = require("../../r-bridge/retriever");
14
+ const ansi_1 = require("../../util/text/ansi");
15
+ /** Prefix of an input that is to be re-analyzed whenever the file changes, the counterpart of {@link fileProtocol}. */
16
+ exports.watchProtocol = 'watch://';
17
+ /** Whether `s` looks like a filesystem path the user likely meant to load via {@link fileProtocol}. */
18
+ function looksLikePath(s) {
19
+ if (s.startsWith(retriever_1.fileProtocol) || s.startsWith(exports.watchProtocol)) {
20
+ return false;
21
+ }
22
+ if (/^(~|\.{0,2}\/|[a-zA-Z]:[\\/])/.test(s)) {
23
+ return true;
24
+ }
25
+ // a single path-like token (a separator, no R-code punctuation) that actually exists on disk
26
+ return /^[^\s()]+\/[^\s()]+$/.test(s) && fs_1.default.existsSync(s);
27
+ }
28
+ /** The input to analyze: one that looks like a path gets the {@link fileProtocol}, unless the repl config says not to. */
29
+ function handlePathLikeInput(output, input, config) {
30
+ if (!looksLikePath(input)) {
31
+ return input;
32
+ }
33
+ const asFile = retriever_1.fileProtocol + input;
34
+ if (config.repl.autoUseFileProtocol) {
35
+ output.stdout((0, ansi_1.ansiInfo)(`'${input}' looks like a path, analyzing ${(0, ansi_1.bold)(asFile, output.formatter)} (${(0, ansi_1.bold)('repl.autoUseFileProtocol', output.formatter)} is set).`));
36
+ return asFile;
37
+ }
38
+ output.stdout((0, ansi_1.ansiInfo)(`'${input}' looks like a path. To analyze it, use ${(0, ansi_1.bold)(asFile, output.formatter)} (or ${(0, ansi_1.bold)(exports.watchProtocol + input, output.formatter)} to re-run on changes), or re-enable ${(0, ansi_1.bold)('repl.autoUseFileProtocol', output.formatter)} to have flowR do this for you. Use ${(0, ansi_1.bold)(':help', output.formatter)} for more.`));
39
+ return input;
40
+ }
41
+ //# sourceMappingURL=path-input.js.map
@@ -17,7 +17,7 @@ async function versionReplString(parser) {
17
17
  }
18
18
  /**
19
19
  * Compact, dimmed note on the bundled signature databases (merged into the engine parenthesis): one linked ref per
20
- * scope present on disk (`current`, `full-history`) with its last update; `base` only when nothing richer ships.
20
+ * scope present on disk (`current`, `base`, `full-history`) with its last update.
21
21
  * The full history is on disk as `history.*` (mounted alongside `current.*`), or a merged `full.*` in a baked container.
22
22
  */
23
23
  function sigDbSummaryString() {
@@ -29,16 +29,14 @@ function sigDbSummaryString() {
29
29
  }
30
30
  let date;
31
31
  try {
32
- date = (0, manifest_1.readManifestFile)(file).date;
32
+ date = (0, manifest_1.readManifestDate)(file);
33
33
  }
34
34
  catch { /* a corrupt/unreadable manifest must not break --version */ }
35
35
  entries.push({ label, file, date });
36
36
  };
37
37
  add('current', (0, manifest_1.defaultSigDbPath)('current'));
38
+ add('base', (0, manifest_1.defaultSigDbPath)('base'));
38
39
  add('full-history', (0, manifest_1.defaultSigDbPath)('full') ?? (0, manifest_1.defaultSigDbPath)('history'));
39
- if (entries.length === 0) {
40
- add('base', (0, manifest_1.defaultSigDbPath)('base'));
41
- }
42
40
  if (entries.length === 0) {
43
41
  return it('no sigdb');
44
42
  }