@eagleoutice/flowr 2.13.0 → 2.13.2

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 (97) hide show
  1. package/README.md +23 -23
  2. package/cli/common/options.d.ts +10 -0
  3. package/cli/common/options.js +2 -0
  4. package/cli/common/scripts-info.d.ts +10 -0
  5. package/cli/flowr.js +21 -5
  6. package/cli/repl/commands/repl-commands.d.ts +8 -0
  7. package/cli/repl/commands/repl-commands.js +27 -12
  8. package/cli/repl/commands/repl-query.js +9 -1
  9. package/cli/repl/commands/repl-signature.js +8 -1
  10. package/cli/repl/core.js +13 -10
  11. package/cli/repl/print-version.js +1 -1
  12. package/cli/repl/server/connection.d.ts +1 -1
  13. package/cli/repl/server/net.js +15 -0
  14. package/cli/slicer-app.d.ts +2 -0
  15. package/cli/slicer-app.js +2 -1
  16. package/config.d.ts +31 -0
  17. package/config.js +55 -2
  18. package/data/sigdb/sigdb.remote.json +1 -1
  19. package/dataflow/environments/identifier.d.ts +9 -8
  20. package/dataflow/environments/identifier.js +21 -13
  21. package/dataflow/eval/resolve/resolve-working-directory.d.ts +29 -0
  22. package/dataflow/eval/resolve/resolve-working-directory.js +168 -0
  23. package/dataflow/extractor.js +2 -1
  24. package/dataflow/graph/df-helper.d.ts +3 -2
  25. package/dataflow/graph/df-helper.js +11 -15
  26. package/dataflow/graph/diff-dataflow-graph.js +1 -1
  27. package/dataflow/graph/graph-helper.js +2 -6
  28. package/dataflow/graph/graph.d.ts +24 -0
  29. package/dataflow/graph/graph.js +25 -1
  30. package/documentation/wiki-interface.js +1 -0
  31. package/documentation/wiki-linter.js +1 -0
  32. package/documentation/wiki-mk/doc-context.d.ts +10 -0
  33. package/documentation/wiki-mk/doc-context.js +3 -0
  34. package/documentation/wiki-query.js +4 -3
  35. package/documentation/wiki-signature-database.js +16 -6
  36. package/linter/linter-rules.d.ts +24 -2
  37. package/linter/linter-rules.js +3 -1
  38. package/linter/rules/absolute-path.d.ts +4 -4
  39. package/linter/rules/absolute-path.js +7 -5
  40. package/linter/rules/file-path-validity.d.ts +1 -1
  41. package/linter/rules/file-path-validity.js +48 -8
  42. package/linter/rules/function-finder-util.d.ts +2 -1
  43. package/linter/rules/syntactically-valid.d.ts +58 -0
  44. package/linter/rules/syntactically-valid.js +203 -0
  45. package/linter/rules/undefined-symbol.js +3 -2
  46. package/package.json +5 -4
  47. package/project/context/classify-project-kind.d.ts +40 -0
  48. package/project/context/classify-project-kind.js +76 -0
  49. package/project/context/flowr-analyzer-context.d.ts +2 -0
  50. package/project/context/flowr-analyzer-context.js +6 -0
  51. package/project/context/flowr-analyzer-dependencies-context.d.ts +23 -4
  52. package/project/context/flowr-analyzer-dependencies-context.js +23 -1
  53. package/project/context/flowr-analyzer-files-context.d.ts +18 -8
  54. package/project/context/flowr-analyzer-files-context.js +66 -68
  55. package/project/context/flowr-file.d.ts +5 -0
  56. package/project/context/flowr-file.js +5 -0
  57. package/project/dependency-version-space.d.ts +3 -1
  58. package/project/dependency-version-space.js +26 -20
  59. package/project/flowr-analyzer.d.ts +3 -0
  60. package/project/flowr-analyzer.js +4 -0
  61. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.d.ts +12 -4
  62. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +25 -10
  63. package/project/plugins/plugin-registry.d.ts +2 -1
  64. package/project/plugins/plugin-registry.js +4 -1
  65. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.d.ts +57 -2
  66. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +150 -28
  67. package/project/sigdb/decompress.d.ts +1 -1
  68. package/project/sigdb/decompress.js +4 -1
  69. package/project/sigdb/manifest.js +60 -26
  70. package/project/sigdb/sigdb-download.d.ts +6 -7
  71. package/project/sigdb/sigdb-download.js +30 -9
  72. package/queries/catalog/config-query/config-query-executor.js +3 -0
  73. package/queries/catalog/config-query/config-query-format.d.ts +5 -3
  74. package/queries/catalog/config-query/config-query-format.js +31 -21
  75. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +0 -10
  76. package/queries/catalog/dependencies-query/dependencies-query-format.js +0 -106
  77. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +21 -5
  78. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +4 -2
  79. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +17 -3
  80. package/queries/catalog/linter-query/linter-query-format.js +9 -2
  81. package/queries/catalog/signature-query/signature-query-executor.js +3 -0
  82. package/queries/catalog/signature-query/signature-query-render.js +4 -4
  83. package/queries/query.d.ts +4 -4
  84. package/queries/query.js +9 -2
  85. package/r-bridge/data/data.d.ts +5 -0
  86. package/r-bridge/data/data.js +6 -0
  87. package/r-bridge/retriever.js +6 -1
  88. package/r-bridge/shell.js +5 -0
  89. package/search/flowr-search-filters.d.ts +2 -1
  90. package/util/files.d.ts +6 -4
  91. package/util/files.js +30 -8
  92. package/util/mermaid/dfg.js +1 -1
  93. package/util/schema.d.ts +2 -0
  94. package/util/schema.js +13 -0
  95. package/util/text/ansi.d.ts +7 -3
  96. package/util/text/ansi.js +8 -5
  97. package/util/version.js +4 -4
@@ -28,6 +28,8 @@ export interface GuessDepVersionsQuery extends BaseQueryFormat {
28
28
  readonly maxIterations?: number;
29
29
  /** ignore the project's declared constraints (`DESCRIPTION` ranges, lockfile pins, transitive requirements); guess purely from code usage and the date/R bounds */
30
30
  readonly clean?: boolean;
31
+ /** exclude these evidence sources from consideration entirely (repl: `--disabled` followed by their one-letter codes, e.g. `--disabled ds` for declared+signature) */
32
+ readonly disabled?: readonly ConstraintSource[];
31
33
  /** also explode the guessed space into concrete per-dependency version assignments (see {@link GuessExplodeOptions}) */
32
34
  readonly explode?: GuessExplodeOptions;
33
35
  }
@@ -105,14 +107,14 @@ export interface GuessDepVersionsQueryResult extends BaseQueryResult {
105
107
  /** a note, e.g. when the signature database is unavailable */
106
108
  readonly message?: string;
107
109
  }
108
- /** parse a repl line: `[(clean[:<=YYYY])] [pkg ...] [--date YYYY.MM.DD] [--max N] [--iterations N] [--explode [--oldest] [--limit N] [--prefer pkg=ver ...]]` */
110
+ /** parse a repl line: `[(clean[:<=YYYY])] [pkg ...] [--date YYYY.MM.DD] [--max N] [--iterations N] [--disabled <letters>] [--explode [--oldest] [--limit N] [--prefer pkg=ver ...]]` */
109
111
  declare function guessDepVersionsLineParser(_output: ReplOutput, line: readonly string[], _config: FlowrConfig): ParsedQueryLine<'guess-dep-versions'>;
110
112
  export declare const GuessDepVersionsQueryDefinition: {
111
113
  readonly title: "Guess Dependency Versions Query";
112
114
  readonly executor: typeof executeGuessDepVersionsQuery;
113
115
  readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _analyzer: import("../../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[], _query: readonly import("../../query").Query[]) => true;
114
116
  readonly fromLine: typeof guessDepVersionsLineParser;
115
- readonly syntax: "@guess-dep-versions [<pkg> ...] [(clean | <=YYYY.MM.DD)] [--date YYYY.MM.DD] [--max <n>] [--iterations <n>] [--explode [--oldest] [--limit <n>] [--prefer <pkg>=<ver>]] <code | file://path>";
117
+ readonly syntax: "@guess-dep-versions [<pkg> ...] [(clean | <=YYYY.MM.DD)] [--date YYYY.MM.DD] [--max <n>] [--iterations <n>] [--disabled <letters>] [--explode [--oldest] [--limit <n>] [--prefer <pkg>=<ver>]] <code | file://path>";
116
118
  readonly schema: Joi.ObjectSchema<any>;
117
119
  readonly flattenInvolvedNodes: () => NodeId[];
118
120
  };
@@ -15,7 +15,7 @@ const config_1 = require("../../../config");
15
15
  const guess_dep_versions_query_executor_1 = require("./guess-dep-versions-query-executor");
16
16
  /** the default cap on how many surviving candidate versions are listed per dependency */
17
17
  exports.DefaultCandidateCap = 16;
18
- /** parse a repl line: `[(clean[:<=YYYY])] [pkg ...] [--date YYYY.MM.DD] [--max N] [--iterations N] [--explode [--oldest] [--limit N] [--prefer pkg=ver ...]]` */
18
+ /** parse a repl line: `[(clean[:<=YYYY])] [pkg ...] [--date YYYY.MM.DD] [--max N] [--iterations N] [--disabled <letters>] [--explode [--oldest] [--limit N] [--prefer pkg=ver ...]]` */
19
19
  function guessDepVersionsLineParser(_output, line, _config) {
20
20
  const packages = [];
21
21
  const codeParts = [];
@@ -27,6 +27,7 @@ function guessDepVersionsLineParser(_output, line, _config) {
27
27
  let order;
28
28
  let limit;
29
29
  const prefer = {};
30
+ const disabled = new Set();
30
31
  // an optional parenthesised clause `(clean)`, `(<=2025)`, or `(clean:<=2025)`: `clean` drops declared constraints, a (`<=`-prefixed) date caps the window
31
32
  const tokens = [...line];
32
33
  const open = tokens.findIndex(t => t.startsWith('('));
@@ -78,6 +79,14 @@ function guessDepVersionsLineParser(_output, line, _config) {
78
79
  else if (tok === '--only') {
79
80
  packages.push(...(tokens[++i] ?? '').split(',').map(s => s.trim()).filter(s => s.length > 0));
80
81
  }
82
+ else if (tok === '--disabled') {
83
+ for (const ch of tokens[++i] ?? '') {
84
+ const source = letterToSource[ch];
85
+ if (source) {
86
+ disabled.add(source);
87
+ }
88
+ }
89
+ }
81
90
  else if (!tok.startsWith('--')) {
82
91
  // every bare token is the code to analyse (a `file://`/`watch://` target, a bare path -- auto-prepended to
83
92
  // `file://` by the repl -- or inline R code); package filters are the explicit `--only` flag, so nothing is guessed
@@ -100,6 +109,7 @@ function guessDepVersionsLineParser(_output, line, _config) {
100
109
  ...(maxCandidates !== undefined && !Number.isNaN(maxCandidates) ? { maxCandidates } : {}),
101
110
  ...(maxIterations !== undefined && !Number.isNaN(maxIterations) ? { maxIterations } : {}),
102
111
  ...(clean ? { clean } : {}),
112
+ ...(disabled.size > 0 ? { disabled: [...disabled] } : {}),
103
113
  ...explodeOpts
104
114
  }]
105
115
  };
@@ -133,6 +143,8 @@ const evidenceLetter = {
133
143
  available: '#',
134
144
  indirect: 'i'
135
145
  };
146
+ /** inverse of {@link evidenceLetter}, decoding a `--disabled` flag's letters back to sources */
147
+ const letterToSource = Object.fromEntries(Object.entries(evidenceLetter).map(([source, letter]) => [letter, source]));
136
148
  /** the tightest bound among a function's signature constraints for the given operator: highest `>=` or lowest `<=` */
137
149
  function tightestBound(evs, op) {
138
150
  let best, bestVer;
@@ -287,7 +299,7 @@ exports.GuessDepVersionsQueryDefinition = {
287
299
  const reasons = [evs.some(e => !e.parameter) ? 'new' : undefined, params.length > 0 ? `params: [${formatParams(params)}]` : undefined].filter(Boolean).join(', ');
288
300
  const name = identifier_1.Identifier.getName(identifier_1.Identifier.parse(fn));
289
301
  const url = (0, signature_query_executor_1.rdrrDocUrl)(dep.package, name, { base: dep.base, cran: !dep.base });
290
- const label = (url ? formatter.hyperlink(name, url) : name) + (reasons ? ` (${reasons})` : '');
302
+ const label = (url ? formatter.hyperlink(name, url, true) : name) + (reasons ? ` (${reasons})` : '');
291
303
  const redundant = !(geVer !== undefined && geVer === tightestGe) && !(leVer !== undefined && leVer === tightestLe);
292
304
  return { bounds: [ge, le].filter(Boolean).join(' '), label, redundant, geVer, leVer };
293
305
  }).sort((a, b) => r_version_1.RVersion.compare(b.geVer, a.geVer) || r_version_1.RVersion.compare(b.leVer, a.leVer));
@@ -312,7 +324,7 @@ exports.GuessDepVersionsQueryDefinition = {
312
324
  return true;
313
325
  },
314
326
  fromLine: guessDepVersionsLineParser,
315
- syntax: '@guess-dep-versions [<pkg> ...] [(clean | <=YYYY.MM.DD)] [--date YYYY.MM.DD] [--max <n>] [--iterations <n>] [--explode [--oldest] [--limit <n>] [--prefer <pkg>=<ver>]] <code | file://path>',
327
+ syntax: '@guess-dep-versions [<pkg> ...] [(clean | <=YYYY.MM.DD)] [--date YYYY.MM.DD] [--max <n>] [--iterations <n>] [--disabled <letters>] [--explode [--oldest] [--limit <n>] [--prefer <pkg>=<ver>]] <code | file://path>',
316
328
  schema: joi_1.default.object({
317
329
  type: joi_1.default.string().valid('guess-dep-versions').required().description('The type of the query.'),
318
330
  packages: joi_1.default.array().items(joi_1.default.string()).optional().description('Restrict the guess to these packages; omit to guess for every declared and used dependency.'),
@@ -320,6 +332,8 @@ exports.GuessDepVersionsQueryDefinition = {
320
332
  maxCandidates: joi_1.default.number().integer().min(0).optional().description('Cap the number of candidate versions listed per dependency.'),
321
333
  maxIterations: joi_1.default.number().integer().min(0).optional().description('Bound both fixpoint loops (mutual transitive refinement and arc consistency).'),
322
334
  clean: joi_1.default.boolean().optional().description('Ignore the project declared constraints (DESCRIPTION/lockfile/transitive); guess purely from code usage and the date/R bounds.'),
335
+ disabled: joi_1.default.array().items(joi_1.default.string().valid('declared', 'transitive', 'signature', 'date', 'base-r', 'available', 'indirect')).optional()
336
+ .description('Exclude these evidence sources from consideration entirely (repl: --disabled followed by their one-letter codes, e.g. --disabled ds for declared+signature).'),
323
337
  explode: joi_1.default.object({
324
338
  order: joi_1.default.string().valid('newest', 'oldest').optional().description('Iterate each dependency newest-first (default) or oldest-first.'),
325
339
  prefer: joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.string()).optional().description('A version to prefer per dependency when it survives the constraints.'),
@@ -12,6 +12,7 @@ const ansi_1 = require("../../../util/text/ansi");
12
12
  const time_1 = require("../../../util/text/time");
13
13
  const retriever_1 = require("../../../r-bridge/retriever");
14
14
  const assert_1 = require("../../../util/assert");
15
+ const fs_1 = __importDefault(require("fs"));
15
16
  const linter_output_1 = require("../../../linter/linter-output");
16
17
  function rulesFromInput(output, rulesPart) {
17
18
  return rulesPart
@@ -105,7 +106,13 @@ exports.LinterQueryDefinition = {
105
106
  const allDidFail = Object.values(out.results).every(linter_format_1.LintingResults.isError);
106
107
  if (allDidFail) {
107
108
  result.push('All linting rules failed to execute.');
108
- if (analyzer.inspectContext().files.loadingOrder.getUnorderedRequests().length === 0) {
109
+ const files = analyzer.inspectContext().files;
110
+ if (files.loadingOrder.getUnorderedRequests().length === 0) {
111
+ const missing = files.getRequestedRoots().filter(p => !fs_1.default.existsSync(p));
112
+ if (missing.length > 0) {
113
+ result.push(formatter.format(`Path does not exist: ${missing.map(p => `'${p}'`).join(', ')}`, { color: 1 /* Colors.Red */, effect: ansi_1.ColorEffect.Foreground, style: 1 /* FontStyles.Bold */ }));
114
+ return true;
115
+ }
109
116
  result.push(formatter.format('No requests to lint for were found in the analysis.', { color: 1 /* Colors.Red */, effect: ansi_1.ColorEffect.Foreground, style: 1 /* FontStyles.Bold */ }));
110
117
  result.push('If you consider this an error, please report a bug: ' + (0, assert_1.getGuardIssueUrl)('analyzer found no requests to lint for'));
111
118
  }
@@ -189,7 +196,7 @@ function hyperlinkLocations(pretty, formatter) {
189
196
  return pretty.replace(locationPattern, (match, path, position) => {
190
197
  const [line, col] = position.split('-')[0].split('.');
191
198
  const url = `file://${path}:${line}${col ? `:${col}` : ''}`;
192
- return formatter.hyperlink(match, url);
199
+ return formatter.hyperlink(match, url, true);
193
200
  });
194
201
  }
195
202
  function renderMetaData(metadata) {
@@ -631,6 +631,9 @@ async function executeSignatureQuery({ analyzer }, queries) {
631
631
  return { ...meta(), message: versionNotFoundMessage(q.package, `no release of '${q.package}' matches '${q.version}'.`, avail, owning[0].isBaseR(q.package)) };
632
632
  }
633
633
  }
634
+ if (found.matchCount === 0 && q.function !== undefined && !hasGlob(q.function)) {
635
+ return { ...meta(), ...found, message: `No function named exactly '${q.function}'. Try a wildcard like '*${q.function}*'.` };
636
+ }
634
637
  return { ...meta(), ...found };
635
638
  }
636
639
  // every source holding the package: `current` keeps the latest, `history` the older releases, so the resolved
@@ -38,12 +38,12 @@ const MaxList = 25;
38
38
  const baseSet = new Set((0, r_base_packages_1.baseRPackages)());
39
39
  /** a package name linked to its CRAN page (unless it is base R / the `R` language pseudo-package) */
40
40
  function linkPackage(name, f) {
41
- return name === 'R' || baseSet.has(name) ? name : f.hyperlink(name, (0, signature_query_executor_1.cranPageUrl)(name));
41
+ return name === 'R' || baseSet.has(name) ? name : f.hyperlink(name, (0, signature_query_executor_1.cranPageUrl)(name), true);
42
42
  }
43
43
  /** a `file:line` location, linked to its source when a url is known */
44
44
  function linkLocation(file, line, url, f) {
45
45
  const text = `${file}${line !== undefined ? `:${line}` : ''}`;
46
- return url ? f.hyperlink(text, url) : text;
46
+ return url ? f.hyperlink(text, url, true) : text;
47
47
  }
48
48
  /** render one parameter: required (no default) in yellow, non-forced (lazily evaluated) italicised, default dimmed */
49
49
  function renderParameter(f, p) {
@@ -86,7 +86,7 @@ function pushFunction(result, f, fn) {
86
86
  listLine('dispatches to', fn.s3methods ?? [], MaxList);
87
87
  listLine('calls', fn.callees, MaxList);
88
88
  if (fn.callGraph) {
89
- result.push(` ╰ ${(0, ansi_1.italic)('call graph', f)} ${f.hyperlink('mermaid', fn.callGraph)}`);
89
+ result.push(` ╰ ${(0, ansi_1.italic)('call graph', f)} ${f.hyperlink('mermaid', fn.callGraph, true)}`);
90
90
  }
91
91
  }
92
92
  /** render the full view of a single package into `result` */
@@ -164,7 +164,7 @@ function pushPackages(result, f, out) {
164
164
  const cap = out.truncated ? (0, ansi_1.italic)(` (capped at ${packages.length})`, f) : '';
165
165
  result.push(` ╰ ${(0, ansi_1.bold)(String(packages.length), f)} package${packages.length === 1 ? '' : 's'} matched${cap}`);
166
166
  for (const pm of packages) {
167
- const name = pm.cranPage ? f.hyperlink((0, ansi_1.color)(pm.name, 6 /* Colors.Cyan */, f), pm.cranPage) : (0, ansi_1.color)(pm.name, 6 /* Colors.Cyan */, f);
167
+ const name = pm.cranPage ? f.hyperlink((0, ansi_1.color)(pm.name, 6 /* Colors.Cyan */, f), pm.cranPage, true) : (0, ansi_1.color)(pm.name, 6 /* Colors.Cyan */, f);
168
168
  const kind = pm.base ? (0, ansi_1.italic)(' base R', f) : pm.cran ? (0, ansi_1.italic)(' CRAN', f) : '';
169
169
  const vers = pm.versions ? `: ${pm.versions.join(', ')}` : pm.latest ? ` ${(0, ansi_1.color)('v' + pm.latest, 2 /* Colors.Green */, f)}` : '';
170
170
  result.push(` ╰ ${name}${vers}${kind}`);
@@ -89,11 +89,11 @@ export declare const SupportedQueries: {
89
89
  };
90
90
  readonly config: {
91
91
  readonly title: "Config Query";
92
- readonly syntax: "@config [<path> | <glob>] | @config +<path>=<value>";
92
+ readonly syntax: "@config [<path> | <glob>] | @config +<path>=<value> | @config +reset";
93
93
  readonly executor: typeof import("./catalog/config-query/config-query-executor").executeConfigQuery;
94
94
  readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: unknown, queryResults: BaseQueryResult, result: string[], queries: readonly Query[]) => true;
95
- readonly completer: (partialLine: readonly string[], startingNewArg: boolean, config: FlowrConfig) => CommandCompletions;
96
- readonly fromLine: (output: ReplOutput, line: readonly string[], config: FlowrConfig) => ParsedQueryLine<"config">;
95
+ readonly completer: (partialLine: readonly string[], startingNewArg: boolean, _config: FlowrConfig) => CommandCompletions;
96
+ readonly fromLine: (output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"config">;
97
97
  readonly schema: Joi.ObjectSchema<any>;
98
98
  readonly flattenInvolvedNodes: () => never[];
99
99
  };
@@ -332,7 +332,7 @@ export declare const SupportedQueries: {
332
332
  readonly executor: typeof import("./catalog/guess-dep-versions-query/guess-dep-versions-query-executor").executeGuessDepVersionsQuery;
333
333
  readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[], _query: readonly Query[]) => true;
334
334
  readonly fromLine: (_output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"guess-dep-versions">;
335
- readonly syntax: "@guess-dep-versions [<pkg> ...] [(clean | <=YYYY.MM.DD)] [--date YYYY.MM.DD] [--max <n>] [--iterations <n>] [--explode [--oldest] [--limit <n>] [--prefer <pkg>=<ver>]] <code | file://path>";
335
+ readonly syntax: "@guess-dep-versions [<pkg> ...] [(clean | <=YYYY.MM.DD)] [--date YYYY.MM.DD] [--max <n>] [--iterations <n>] [--disabled <letters>] [--explode [--oldest] [--limit <n>] [--prefer <pkg>=<ver>]] <code | file://path>";
336
336
  readonly schema: Joi.ObjectSchema<any>;
337
337
  readonly flattenInvolvedNodes: () => NodeId[];
338
338
  };
package/queries/query.js CHANGED
@@ -36,6 +36,7 @@ const linter_query_format_1 = require("./catalog/linter-query/linter-query-forma
36
36
  const control_flow_query_format_1 = require("./catalog/control-flow-query/control-flow-query-format");
37
37
  const inspect_higher_order_query_format_1 = require("./catalog/inspect-higher-order-query/inspect-higher-order-query-format");
38
38
  const log_1 = require("../util/log");
39
+ const fs_1 = __importDefault(require("fs"));
39
40
  const files_query_format_1 = require("./catalog/files-query/files-query-format");
40
41
  const call_graph_query_format_1 = require("./catalog/call-graph-query/call-graph-query-format");
41
42
  const inspect_recursion_query_format_1 = require("./catalog/inspect-recursion-query/inspect-recursion-query-format");
@@ -134,7 +135,7 @@ async function executeQueries(data, queries) {
134
135
  }
135
136
  catch (e) {
136
137
  const message = e instanceof Error ? e.message : String(e);
137
- log_1.log.error(`query of type '${type}' failed: ${message}`);
138
+ log_1.log.error(`query of type '${type}' failed: ${message.split('\n')[0]}`);
138
139
  results.push([type, { '.meta': { timing: 0 }, error: message }]);
139
140
  }
140
141
  }
@@ -182,7 +183,13 @@ async function genericWrapReplFailIfNoRequest(fn, output, analyzer) {
182
183
  return await fn();
183
184
  }
184
185
  catch (e) {
185
- if (analyzer.inspectContext().files.loadingOrder.getUnorderedRequests().length === 0) {
186
+ const files = analyzer.inspectContext().files;
187
+ if (files.loadingOrder.getUnorderedRequests().length === 0) {
188
+ const missing = files.getRequestedRoots().filter(p => !fs_1.default.existsSync(p));
189
+ if (missing.length > 0) {
190
+ output.stderr(output.formatter.format(`Path does not exist: ${missing.map(p => `'${p}'`).join(', ')}`, { color: 1 /* Colors.Red */, style: 1 /* FontStyles.Bold */, effect: ansi_1.ColorEffect.Foreground }));
191
+ return;
192
+ }
186
193
  output.stderr(output.formatter.format('No requests to analyze were found.', { color: 1 /* Colors.Red */, style: 1 /* FontStyles.Bold */, effect: ansi_1.ColorEffect.Foreground })
187
194
  + '\nIf you consider this an error, please report a bug: '
188
195
  + (0, assert_1.getGuardIssueUrl)('analyzer found no requests to analyze'));
@@ -228,6 +228,11 @@ export declare const flowrCapabilities: {
228
228
  readonly id: "functions-with-global-side-effects";
229
229
  readonly supported: "partially";
230
230
  readonly description: "_Support functions like `setwd` which have an impact on the subsequent program._";
231
+ }, {
232
+ readonly name: "Working Directory";
233
+ readonly id: "working-directory";
234
+ readonly supported: "partially";
235
+ readonly description: "_Track the effective working directory across `setwd` (control-flow- and location-sensitive) to resolve relative file paths. Interprocedural, sourced, and loop cases are treated as unbounded rather than guessed._";
231
236
  }, {
232
237
  readonly name: "Index Access";
233
238
  readonly id: "index-access";
@@ -297,6 +297,12 @@ ${await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { simplified: true })}
297
297
  supported: 'partially',
298
298
  description: '_Support functions like `setwd` which have an impact on the subsequent program._'
299
299
  },
300
+ {
301
+ name: 'Working Directory',
302
+ id: 'working-directory',
303
+ supported: 'partially',
304
+ description: '_Track the effective working directory across `setwd` (control-flow- and location-sensitive) to resolve relative file paths. Interprocedural, sourced, and loop cases are treated as unbounded rather than guessed._'
305
+ },
300
306
  {
301
307
  name: 'Index Access',
302
308
  id: 'index-access',
@@ -21,6 +21,7 @@ const init_1 = require("./init");
21
21
  const convert_values_1 = require("./lang-4.x/convert-values");
22
22
  const decorate_1 = require("./lang-4.x/ast/model/processing/decorate");
23
23
  const type_1 = require("./lang-4.x/ast/model/type");
24
+ const log_1 = require("../util/log");
24
25
  const fs_1 = __importDefault(require("fs"));
25
26
  const path_1 = __importDefault(require("path"));
26
27
  exports.fileProtocol = 'file://';
@@ -73,12 +74,16 @@ function requestProviderFromFile() {
73
74
  }
74
75
  // walk the directory and find the first match
75
76
  const dir = path_1.default.dirname(p);
77
+ if (!fs_1.default.existsSync(dir)) {
78
+ return undefined;
79
+ }
76
80
  const file = path_1.default.basename(p);
77
81
  const files = fs_1.default.readdirSync(dir);
78
82
  const found = files.find(f => f.toLowerCase() === file.toLowerCase());
79
83
  return found ? path_1.default.join(dir, found) : undefined;
80
84
  }
81
- catch {
85
+ catch (e) {
86
+ log_1.log.warn(`Could not resolve '${p}': ${e instanceof Error ? e.message : String(e)}`);
82
87
  return undefined;
83
88
  }
84
89
  },
package/r-bridge/shell.js CHANGED
@@ -316,6 +316,11 @@ class RShellSession {
316
316
  this.onExit(() => {
317
317
  this.end();
318
318
  });
319
+ this.bareSession.on('error', (err) => {
320
+ log.error(`Failed to start R ("${options.pathToRExecutable}"): ${err.message}. `
321
+ + 'Make sure R is installed and on PATH (point flowR to it with --r-path), '
322
+ + 'or skip R entirely with --engine.r-shell.disabled / --default-engine tree-sitter.');
323
+ });
319
324
  this.options = options;
320
325
  // initialize the session
321
326
  this.writeLine((0, init_1.initCommand)(options.eol));
@@ -6,6 +6,7 @@ import type { Enrichment } from './search-executor/search-enrichers';
6
6
  import type { DataflowInformation } from '../dataflow/info';
7
7
  import type { BuiltInProcName } from '../dataflow/environments/built-in-proc-name';
8
8
  import type { RoleInParent } from '../r-bridge/lang-4.x/ast/model/processing/role';
9
+ import type { Identifier } from '../dataflow/environments/identifier';
9
10
  export type FlowrFilterName = keyof typeof FlowrFilters;
10
11
  interface FlowrFilterWithArgs<Filter extends FlowrFilterName, Args extends FlowrFilterArgs<Filter>> {
11
12
  name: Filter;
@@ -80,7 +81,7 @@ export interface FilePathFilterArgs {
80
81
  /**
81
82
  * Helper to create a regular expression that matches function names, ignoring their package.
82
83
  */
83
- export declare function testFunctionsIgnoringPackage(functions: readonly string[]): RegExp;
84
+ export declare function testFunctionsIgnoringPackage(functions: readonly Identifier[]): RegExp;
84
85
  type ValidFilterTypes<F extends FlowrFilter = FlowrFilter> = FlowrFilterName | FlowrFilterWithArgs<F, FlowrFilterArgs<F>> | RType | VertexType;
85
86
  /**
86
87
  * By default, we provide filter for every {@link RType} and {@link VertexType}.
package/util/files.d.ts CHANGED
@@ -9,12 +9,13 @@ export interface Table {
9
9
  }
10
10
  /**
11
11
  * Retrieves all files in the given directory recursively
12
- * @param dir - Directory path to start the search from
13
- * @param suffix - Suffix of the files to be retrieved
12
+ * @param dir - Directory path to start the search from
13
+ * @param suffix - Suffix of the files to be retrieved
14
+ * @param throwOnError - If `true`, a directory that cannot be read aborts the traversal; otherwise it is logged and skipped (the default)
14
15
  * Based on {@link https://stackoverflow.com/a/45130990}
15
16
  * @see {@link getAllFilesSync} for a synchronous version.
16
17
  */
17
- export declare function getAllFiles(dir: string, suffix?: RegExp): AsyncGenerator<string>;
18
+ export declare function getAllFiles(dir: string, suffix?: RegExp, throwOnError?: boolean): AsyncGenerator<string>;
18
19
  /**
19
20
  * Retrieves all files in the given directory recursively (synchronously)
20
21
  * @param dir - Directory path to start the search from
@@ -22,9 +23,10 @@ export declare function getAllFiles(dir: string, suffix?: RegExp): AsyncGenerato
22
23
  * @param ignoreDirs - Directories to skip, tested against the posix path relative to `dir`
23
24
  * (e.g. `packrat/lib`), so a pattern can address nested directories
24
25
  * @param relativeTo - The path to which the returned paths are relative (used for `ignoreDirs`), defaults to `dir`
26
+ * @param throwOnError - If `true`, a directory that cannot be read aborts the traversal; otherwise it is logged and skipped (the default)
25
27
  * @see {@link getAllFiles} - for an asynchronous version.
26
28
  */
27
- export declare function getAllFilesSync(dir: string, suffix?: RegExp, ignoreDirs?: RegExp | undefined, relativeTo?: string): Generator<string>;
29
+ export declare function getAllFilesSync(dir: string, suffix?: RegExp, ignoreDirs?: RegExp | undefined, relativeTo?: string, throwOnError?: boolean): Generator<string>;
28
30
  /**
29
31
  * Retrieves all R files in a given directory (asynchronously)
30
32
  * @param input - directory-path to start the search from, can be a file as well. Will just return the file then.
package/util/files.js CHANGED
@@ -54,17 +54,28 @@ const log_1 = require("./log");
54
54
  const n_readlines_1 = __importDefault(require("n-readlines"));
55
55
  /**
56
56
  * Retrieves all files in the given directory recursively
57
- * @param dir - Directory path to start the search from
58
- * @param suffix - Suffix of the files to be retrieved
57
+ * @param dir - Directory path to start the search from
58
+ * @param suffix - Suffix of the files to be retrieved
59
+ * @param throwOnError - If `true`, a directory that cannot be read aborts the traversal; otherwise it is logged and skipped (the default)
59
60
  * Based on {@link https://stackoverflow.com/a/45130990}
60
61
  * @see {@link getAllFilesSync} for a synchronous version.
61
62
  */
62
- async function* getAllFiles(dir, suffix = /.*/) {
63
- const entries = await fs_1.promises.readdir(dir, { withFileTypes: true, recursive: false });
63
+ async function* getAllFiles(dir, suffix = /.*/, throwOnError = false) {
64
+ let entries;
65
+ try {
66
+ entries = await fs_1.promises.readdir(dir, { withFileTypes: true, recursive: false });
67
+ }
68
+ catch (e) {
69
+ if (throwOnError) {
70
+ throw e;
71
+ }
72
+ log_1.log.warn(`Skipping '${dir}' during file discovery: ${e instanceof Error ? e.message : String(e)}`);
73
+ return;
74
+ }
64
75
  for (const subEntries of entries) {
65
76
  const res = path_1.default.resolve(dir, subEntries.name);
66
77
  if (subEntries.isDirectory()) {
67
- yield* getAllFiles(res, suffix);
78
+ yield* getAllFiles(res, suffix, throwOnError);
68
79
  }
69
80
  else if (suffix.test(subEntries.name)) {
70
81
  yield res;
@@ -78,15 +89,26 @@ async function* getAllFiles(dir, suffix = /.*/) {
78
89
  * @param ignoreDirs - Directories to skip, tested against the posix path relative to `dir`
79
90
  * (e.g. `packrat/lib`), so a pattern can address nested directories
80
91
  * @param relativeTo - The path to which the returned paths are relative (used for `ignoreDirs`), defaults to `dir`
92
+ * @param throwOnError - If `true`, a directory that cannot be read aborts the traversal; otherwise it is logged and skipped (the default)
81
93
  * @see {@link getAllFiles} - for an asynchronous version.
82
94
  */
83
- function* getAllFilesSync(dir, suffix = /.*/, ignoreDirs = undefined, relativeTo = dir) {
84
- const entries = fs_1.default.readdirSync(dir, { withFileTypes: true, recursive: false });
95
+ function* getAllFilesSync(dir, suffix = /.*/, ignoreDirs = undefined, relativeTo = dir, throwOnError = false) {
96
+ let entries;
97
+ try {
98
+ entries = fs_1.default.readdirSync(dir, { withFileTypes: true, recursive: false });
99
+ }
100
+ catch (e) {
101
+ if (throwOnError) {
102
+ throw e;
103
+ }
104
+ log_1.log.warn(`Skipping '${dir}' during file discovery: ${e instanceof Error ? e.message : String(e)}`);
105
+ return;
106
+ }
85
107
  for (const subEntries of entries) {
86
108
  const res = path_1.default.resolve(dir, subEntries.name);
87
109
  if (subEntries.isDirectory()) {
88
110
  if (!ignoreDirs?.test(toPosixPath(path_1.default.relative(relativeTo, res)))) {
89
- yield* getAllFilesSync(res, suffix, ignoreDirs, relativeTo);
111
+ yield* getAllFilesSync(res, suffix, ignoreDirs, relativeTo, throwOnError);
90
112
  }
91
113
  }
92
114
  else if (suffix.test(subEntries.name)) {
@@ -184,7 +184,7 @@ function vertexToMermaid(info, mermaid, id, idPrefix, mark, includeOnlyIds) {
184
184
  const lexeme = node?.lexeme ?? (node?.type === type_1.RType.ExpressionList ? node?.grouping?.[0]?.lexeme : '') ?? '??';
185
185
  let display = lexeme;
186
186
  if (fCall && (0, vertex_1.isFunctionCallVertex)(info)) {
187
- const q = identifier_1.Identifier.toQualified((0, dfg_get_origin_1.getOriginInDfg)(mermaid.rootGraph, origId), mermaid.qualifyBaseR === false ? undefined : info.name);
187
+ const q = identifier_1.Identifier.toQualified((0, dfg_get_origin_1.getOriginInDfg)(mermaid.rootGraph, origId), info.name, mermaid.qualifyBaseR !== false);
188
188
  const qs = q !== undefined ? identifier_1.Identifier.toString(q) : undefined;
189
189
  if (qs !== undefined && qs !== lexeme) {
190
190
  display = qs;
package/util/schema.d.ts CHANGED
@@ -30,6 +30,8 @@ export declare function firstUnknownSchemaSegment(description: Joi.Description,
30
30
  * In contrast to the keys of a value, this covers the optional ones that are unset as well.
31
31
  */
32
32
  export declare function descriptionPathKeys(description: Joi.Description, path: readonly string[]): string[];
33
+ /** every settable path in a schema description, intermediate objects included */
34
+ export declare function descriptionPaths(description: Joi.Description, path?: readonly string[]): string[][];
33
35
  /**
34
36
  * Describes a Joi schema in a human-readable way.
35
37
  */
package/util/schema.js CHANGED
@@ -4,6 +4,7 @@ exports.descriptionPathInfo = descriptionPathInfo;
4
4
  exports.schemaPathInfo = schemaPathInfo;
5
5
  exports.firstUnknownSchemaSegment = firstUnknownSchemaSegment;
6
6
  exports.descriptionPathKeys = descriptionPathKeys;
7
+ exports.descriptionPaths = descriptionPaths;
7
8
  exports.describeSchema = describeSchema;
8
9
  exports.genericDescription = genericDescription;
9
10
  exports.headerLine = headerLine;
@@ -112,6 +113,18 @@ function descriptionPathKeys(description, path) {
112
113
  const valids = patternObject(node)?.keyValids?.map(v => String(v)) ?? [];
113
114
  return [...keys, ...valids.filter(v => !keys.includes(v))];
114
115
  }
116
+ /** every settable path in a schema description, intermediate objects included */
117
+ function descriptionPaths(description, path = []) {
118
+ const result = [];
119
+ for (const key of descriptionPathKeys(description, path)) {
120
+ const childPath = [...path, key];
121
+ result.push(childPath);
122
+ if (descriptionPathInfo(description, childPath).type === 'object') {
123
+ result.push(...descriptionPaths(description, childPath));
124
+ }
125
+ }
126
+ return result;
127
+ }
115
128
  /**
116
129
  * Describes a Joi schema in a human-readable way.
117
130
  */
@@ -32,8 +32,12 @@ export interface OutputFormatter {
32
32
  format(input: string, options?: FormatOptions): string;
33
33
  getFormatString(options?: FormatOptions): string;
34
34
  reset(): string;
35
- /** render `text` as a link to `url` in whatever form this output supports (OSC 8, markdown, or plain text) */
36
- hyperlink(text: string, url: string): string;
35
+ /**
36
+ * Render `text` as a link to `url` in whatever form this output supports (OSC 8, markdown, or plain text).
37
+ * When a live hyperlink cannot be rendered, the raw `url` is shown so the target is not lost; pass
38
+ * `force` to always emit just the short `text` label instead.
39
+ */
40
+ hyperlink(text: string, url: string, force?: boolean): string;
37
41
  }
38
42
  export declare const voidFormatter: OutputFormatter;
39
43
  export declare const markdownFormatter: OutputFormatter;
@@ -63,7 +67,7 @@ export declare const escape = "\u001B[";
63
67
  export declare function supportsHyperlinks(): boolean;
64
68
  export declare const ansiFormatter: {
65
69
  reset(): string;
66
- hyperlink(text: string, url: string): string;
70
+ hyperlink(text: string, url: string, force?: boolean): string;
67
71
  format(input: string, options?: FormatOptions): string;
68
72
  getFormatString(options?: FormatOptions): string;
69
73
  };
package/util/text/ansi.js CHANGED
@@ -24,8 +24,8 @@ exports.voidFormatter = new class {
24
24
  reset() {
25
25
  return '';
26
26
  }
27
- hyperlink(text, _url) {
28
- return text;
27
+ hyperlink(text, url, force = false) {
28
+ return force ? text : url;
29
29
  }
30
30
  }();
31
31
  exports.markdownFormatter = new class {
@@ -57,7 +57,7 @@ exports.markdownFormatter = new class {
57
57
  reset() {
58
58
  return '';
59
59
  }
60
- hyperlink(text, url) {
60
+ hyperlink(text, url, _force = false) {
61
61
  return `[${text}](${url})`;
62
62
  }
63
63
  }();
@@ -114,8 +114,11 @@ exports.ansiFormatter = {
114
114
  reset() {
115
115
  return `${exports.escape}0${colorSuffix}`;
116
116
  },
117
- hyperlink(text, url) {
118
- return supportsHyperlinks() ? `\x1b]8;;${url}\x07${text}\x1b]8;;\x07` : text;
117
+ hyperlink(text, url, force = false) {
118
+ if (supportsHyperlinks()) {
119
+ return `\x1b]8;;${url}\x07${text}\x1b]8;;\x07`;
120
+ }
121
+ return force ? text : url;
119
122
  },
120
123
  format(input, options) {
121
124
  return `${this.getFormatString(options)}${input}${this.reset()}`;
package/util/version.js CHANGED
@@ -42,7 +42,7 @@ const assert_1 = require("./assert");
42
42
  const sigdb_download_1 = require("../project/sigdb/sigdb-download");
43
43
  const doc_files_1 = require("../documentation/doc-util/doc-files");
44
44
  // this is automatically replaced with the current version by release-it
45
- const version = '2.13.0';
45
+ const version = '2.13.2';
46
46
  // this is automatically replaced with the release date by release-it (regex-bumper, see package.json)
47
47
  const versionDate = '2026-07-15T07:13:44Z';
48
48
  /**
@@ -81,7 +81,7 @@ async function printVersionInformation(output, input, engineOnly = false) {
81
81
  const rReason = r === 'none' ? ' (no R interpreter available)'
82
82
  : r === 'unknown' ? (engine === 'tree-sitter' ? ' (not queried, using the tree-sitter engine)' : ' (could not be determined)')
83
83
  : '';
84
- const flowrValue = versionRegex.test(flowr) ? output.formatter.hyperlink(flowr, `https://github.com/flowr-analysis/flowr/releases/tag/v${flowr}`) : flowr;
84
+ const flowrValue = versionRegex.test(flowr) ? output.formatter.hyperlink(flowr, `https://github.com/flowr-analysis/flowr/releases/tag/v${flowr}`, true) : flowr;
85
85
  const rows = [];
86
86
  const pluginLines = [];
87
87
  if (!engineOnly) {
@@ -97,7 +97,7 @@ async function printVersionInformation(output, input, engineOnly = false) {
97
97
  const sigDbUrl = (0, sigdb_download_1.sigDbRemoteRelease)()?.url;
98
98
  const describe = (d) => {
99
99
  const entry = `${d.scope} (v${d.version}, ${d.date}${d.format ? `, ${d.format}` : ''})`;
100
- return sigDbUrl ? output.formatter.hyperlink(entry, sigDbUrl) : entry;
100
+ return sigDbUrl ? output.formatter.hyperlink(entry, sigDbUrl, true) : entry;
101
101
  };
102
102
  rows.push(['databases', dbs.length === 0 ? 'none' : dbs.map(describe).join(', '), dbs.length === 0]);
103
103
  // the registered plugins, grouped by prefix; collected here and printed after the table (below) so the
@@ -127,7 +127,7 @@ async function printVersionInformation(output, input, engineOnly = false) {
127
127
  const labelWidth = Math.max(...[...byPrefix.keys()].map(p => p.length));
128
128
  const header = `registered plugins (${names.length})`;
129
129
  const hint = trace ? ' (faint = did not activate)' : ' (set +repl.showPlugins=true to track activation)';
130
- pluginLines.push(`${(0, ansi_1.bold)(osc8 ? output.formatter.hyperlink(header, wiki) : header, output.formatter)}:${dim(hint)}`);
130
+ pluginLines.push(`${(0, ansi_1.bold)(output.formatter.hyperlink(header, wiki, true), output.formatter)}:${dim(hint)}`);
131
131
  for (const [prefix, suffixes] of [...byPrefix].sort((a, b) => a[0].localeCompare(b[0]))) {
132
132
  pluginLines.push(` ${(0, ansi_1.bold)(prefix, output.formatter)}:${' '.repeat(labelWidth - prefix.length)} ${[...suffixes].sort((a, b) => a.localeCompare(b)).map(s => render(`${prefix}:${s}`, s)).join(', ')}`);
133
133
  }