@uipath/maestro-builder-sdk 6.110.0 → 6.112.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.
package/dist/check.js CHANGED
@@ -6,7 +6,7 @@ import { FlowNode } from './core/node-classes.js';
6
6
  import { definitionHasErrorPort } from './core/error-port.js';
7
7
  import { bundledDefinition, resolveContributionDefinition, serialize } from './serialize.js';
8
8
  import { checkEventResolution, checkEventSubscription, eventParamsFor, } from './core/event-checks.js';
9
- import { checkCookedEscapes, checkFlowExpressions } from './flow-expr-check.js';
9
+ import { checkCookedEscapes, checkFlowExpressions, literalExprShape, literalLooksLikeExpr } from './flow-expr-check.js';
10
10
  import { FLOW_EXPR_DIALECT, checkBindingLabels, checkConnectorLookups as coreCheckConnectorLookups, checkConnectorResources as coreCheckConnectorResources, checkConnectorSchema as coreCheckConnectorSchema, } from './core/connector-checks.js';
11
11
  import { nearestName } from './core/edit-distance.js';
12
12
  import { escapeRegExp } from './core/escape-regexp.js';
@@ -2498,6 +2498,7 @@ function checkRegisteredStep(entry, s, exprs, errorSource, opts, diags, typeOf,
2498
2498
  },
2499
2499
  };
2500
2500
  impl.check?.(spec, ctx);
2501
+ const lookalikes = new Set();
2501
2502
  for (const site of impl.expressions(spec)) {
2502
2503
  if ('code' in site) {
2503
2504
  // A script body: checked for its `$vars.` refs although it is a string. No
@@ -2506,6 +2507,7 @@ function checkRegisteredStep(entry, s, exprs, errorSource, opts, diags, typeOf,
2506
2507
  }
2507
2508
  else {
2508
2509
  pushDeepExprs(site.value, s.name, errorSource, exprs);
2510
+ pushLiteralLookalikes(site.value, s.name, diags, lookalikes);
2509
2511
  }
2510
2512
  }
2511
2513
  return ctx;
@@ -2562,6 +2564,34 @@ function pushDeepExprs(value, step, errorSource, out) {
2562
2564
  pushDeepExprs(v, step, errorSource, out);
2563
2565
  }
2564
2566
  }
2567
+ /**
2568
+ * LITERAL_LOOKS_LIKE_EXPR (warning): every plain string in an evaluated value
2569
+ * (`value`, walked as `pushDeepExprs` walks it) that reads like an expression
2570
+ * (`literalExprShape`, which documents what it does and does not flag). An
2571
+ * `Expr` is skipped whole, a `lit(...)` included: that is how an author says
2572
+ * the text is meant. One finding per distinct string per step: a URL repeated
2573
+ * in two headers is one mistake.
2574
+ */
2575
+ function pushLiteralLookalikes(value, step, diags, seen) {
2576
+ if (value instanceof Expr)
2577
+ return;
2578
+ if (typeof value === 'string') {
2579
+ const shape = literalExprShape(value);
2580
+ if (shape === undefined || seen.has(value))
2581
+ return;
2582
+ seen.add(value);
2583
+ const { message, suggestion } = literalLooksLikeExpr(value, shape, step);
2584
+ diags.push({ level: 'warning', code: 'LITERAL_LOOKS_LIKE_EXPR', step, message, ...(suggestion !== undefined ? { suggestion } : {}) });
2585
+ }
2586
+ else if (Array.isArray(value)) {
2587
+ for (const v of value)
2588
+ pushLiteralLookalikes(v, step, diags, seen);
2589
+ }
2590
+ else if (value && typeof value === 'object') {
2591
+ for (const v of Object.values(value))
2592
+ pushLiteralLookalikes(v, step, diags, seen);
2593
+ }
2594
+ }
2565
2595
  /** Whether `e` is one of the SDK's own `internal SDK error:` throws, which `check` never turns into a diagnostic. */
2566
2596
  function isInternalSdkError(e) {
2567
2597
  return e instanceof Error && e.message.startsWith('internal SDK error:');
@@ -572,6 +572,7 @@ export declare const REFUSALS: {
572
572
  readonly LIBRARY_NOT_FOUND: "lowering";
573
573
  readonly LIBRARY_REQUIRED: "lowering";
574
574
  readonly LIST_OUTPUT_WRAPPER: "lint";
575
+ readonly LITERAL_LOOKS_LIKE_EXPR: "lint";
575
576
  readonly LOOKUP_ARGS: "lowering";
576
577
  readonly LOOKUP_CONNECTION_MISMATCH: "lint";
577
578
  readonly LOOKUP_LITERAL_ID: "lint";
@@ -648,6 +648,7 @@ export const REFUSALS = {
648
648
  LIBRARY_NOT_FOUND: 'lowering',
649
649
  LIBRARY_REQUIRED: 'lowering',
650
650
  LIST_OUTPUT_WRAPPER: 'lint',
651
+ LITERAL_LOOKS_LIKE_EXPR: 'lint',
651
652
  LOOKUP_ARGS: 'lowering',
652
653
  LOOKUP_CONNECTION_MISMATCH: 'lint',
653
654
  LOOKUP_LITERAL_ID: 'lint',
@@ -27,10 +27,16 @@
27
27
  * (`<Name>.pipeline.mjs`) that chains decompile → [edit] → compile → merge, so an
28
28
  * agent can run one script for the whole brownfield write-back loop. Pass
29
29
  * `--no-pipeline` to skip it.
30
+ *
31
+ * A decompile starts a new loop, so it first removes what an earlier loop
32
+ * compiled for the same `<Name>` into the work directory: `<Name>.baseline/`,
33
+ * `<Name>.edited/`, `<Name>.merged.flow` and the agent folders that candidate
34
+ * named (pipeline-artifacts.ts, #1995). Each is listed (`deleted` in `--json`, as
35
+ * merge reports it). A `<Name>.merged.flow` that differs from the original is kept.
30
36
  */
31
37
  import { reportResult } from './cli-result.js';
32
38
  import { mkdirSync, writeFileSync } from 'node:fs';
33
- import { basename, join, resolve } from 'node:path';
39
+ import { basename, join, relative, resolve } from 'node:path';
34
40
  import { defaultSourceOut, workDirBeside, writeSource } from './workdir.js';
35
41
  import { decompileFlowFile, readFlowFile } from './decompile-file.js';
36
42
  import { sourceDigest, stampFlowSource } from './decompile-stamp.js';
@@ -42,6 +48,7 @@ import { pipelineFrontDoor } from './registry/uip/pipeline-front-door.js';
42
48
  import { flowConnectorRequests, lackedToken } from './registry/fetch/flow-requests.js';
43
49
  import { openWithFetchedDefinitions } from './registry/fetch/with-fetched-definitions.js';
44
50
  import { fetchableNodeType } from './registry/fetch/fetch-definitions.js';
51
+ import { clearPipelineArtifacts } from './pipeline-artifacts.js';
45
52
  /** Derive a PascalCase base name from the flow name/id for the default output file. */
46
53
  function baseName(flow) {
47
54
  const src = flow.name ?? flow.id ?? 'Flow';
@@ -71,7 +78,8 @@ export async function run(argv) {
71
78
  // A `.flow` may be SPLIT across sibling files with JSON Reference — resolve
72
79
  // those into one object model before decompiling (design §5; the format's own
73
80
  // read path does the same). A single-file flow walks through untouched.
74
- const flow = readFlowFile(pos);
81
+ const inputParts = [];
82
+ const flow = readFlowFile(pos, inputParts);
75
83
  // Node-type packages the file needs: loaded only when the project trusts them
76
84
  // (package.json nodePackages, or --package), resolved from the .flow's own
77
85
  // directory (node-packages.ts). An untrusted or missing package is a warning,
@@ -135,11 +143,24 @@ export async function run(argv) {
135
143
  writeSource(out, stamped);
136
144
  console.log(`flow-decompile: wrote ${basename(out)}`);
137
145
  reportResult({ path: resolve(out) });
146
+ // The helper and the baseline/edited/merged candidates it writes are never
147
+ // shipped, so they go in the work directory even when `-o` put the source
148
+ // somewhere visible.
149
+ const workDir = workDirBeside(out);
150
+ // A new source starts a new loop: the compiles an earlier loop left for this
151
+ // flow in the work directory are stale, and inside a Flow project each `.flow`
152
+ // among them is one more deliverable to product validation (#1995). Cleared
153
+ // with or without the pipeline: `--no-pipeline` loops left them too.
154
+ // Never the file this decompile read, nor a folder holding it, nor a part file it $ref'd.
155
+ const cleared = clearPipelineArtifacts(workDir, basename(out).replace(/\.flow\.ts$|\.ts$/, ''), { keep: [pos, ...inputParts], original: flow });
156
+ for (const a of cleared.removed)
157
+ console.log(`flow-decompile: removed ${relativeShown(a.path)} (${a.reason}; this decompile starts a new loop)`);
158
+ for (const a of cleared.kept)
159
+ console.error(`flow-decompile: warning: kept ${relativeShown(a.path)}: ${a.reason}. Delete it yourself if it is an earlier loop's compile: a .flow inside the project is a deliverable`);
160
+ // `deleted`, as merge reports what it deleted; merge's `removed` is what is left for the caller.
161
+ if (cleared.removed.length > 0)
162
+ reportResult({ deleted: cleared.removed.map((a) => resolve(a.path)) });
138
163
  if (!argv.includes('--no-pipeline')) {
139
- // The helper and the baseline/edited/merged candidates it writes are never
140
- // shipped, so they go in the work directory even when `-o` put the source
141
- // somewhere visible.
142
- const workDir = workDirBeside(out);
143
164
  mkdirSync(workDir, { recursive: true });
144
165
  const pipelinePath = join(workDir, basename(out).replace(/\.flow\.ts$|\.ts$/, '') + '.pipeline.mjs');
145
166
  writeFileSync(pipelinePath, pipelineScript(resolve(pos), resolve(out), resolve(pipelinePath)));
@@ -239,4 +260,8 @@ if (!existsSync(BASELINE)) {
239
260
  }
240
261
  `;
241
262
  }
263
+ /** `path` as the user's working directory spells it. */
264
+ function relativeShown(path) {
265
+ return relative(process.cwd(), resolve(path)) || path;
266
+ }
242
267
  runWhenInvokedDirectly(import.meta.url, 'flow-decompile', run);
@@ -36,6 +36,24 @@ export declare function checkFlowExpressions(built: BuiltFlow): LocatedDiagnosti
36
36
  export declare function checkCookedEscapes(built: BuiltFlow): (LocatedDiagnostic & {
37
37
  step?: string;
38
38
  })[];
39
+ /**
40
+ * How a plain string looks like an expression: `text` = sent as written,
41
+ * `template` = interpolated through `{{ … }}`, `wire` = evaluated because it
42
+ * starts with `=`.
43
+ */
44
+ export type LiteralExprShape = 'wire' | 'template' | 'text';
45
+ /** Whether a plain input string looks like an expression the author meant to write as one. */
46
+ export declare function literalExprShape(text: string): LiteralExprShape | undefined;
47
+ /**
48
+ * The finding for one plain string `literalExprShape` matched, worded for `step`.
49
+ * The suggestion is the SDK spelling when the string is exactly one reference
50
+ * (`$vars.s.output.x` or `=vars.s.output.x` → `out('s', 'x')`), or `js` around
51
+ * an `=js:` body.
52
+ */
53
+ export declare function literalLooksLikeExpr(text: string, shape: LiteralExprShape, step: string): {
54
+ message: string;
55
+ suggestion?: string;
56
+ };
39
57
  /**
40
58
  * The expression problems `compile` refuses: every error whose code is
41
59
  * `lowering` (`EXPR_SYNTAX`). The serializer throws a {@link FlowBuildError} on
@@ -280,6 +280,81 @@ export function checkCookedEscapes(built) {
280
280
  visit(built, { where: 'flow', prefix: '' });
281
281
  return out;
282
282
  }
283
+ // ─── LITERAL_LOOKS_LIKE_EXPR (#1970) ────────────────────────────────────────
284
+ //
285
+ // A plain string in a node input is not an expression to the SDK: only
286
+ // `js`/`tmpl`/`out()` build one. TypeScript accepts it (the field is
287
+ // `string | Expr`), the serializer writes it as authored, and no reference,
288
+ // syntax or rename check reaches it. What happens to it at run time depends on
289
+ // its shape, and the rule below names the three shapes that look like an
290
+ // expression the author meant:
291
+ //
292
+ // - `text`: a `$vars.` / `$vars[` / `$metadata.` / `$metadata[` mention outside
293
+ // `{{ … }}`. That part is sent as written: `http({ url: '$vars.s.output.x' })`
294
+ // sends the characters `$vars.s.output.x`.
295
+ // - `template`: every mention sits inside `{{ … }}`. The product's converter
296
+ // compiles such a literal to a template (`{{ $vars.x }}` → `${vars.x}`), so
297
+ // it runs, but unchecked.
298
+ // - `wire`: the string starts with `=`. The engine evaluates every `=` string
299
+ // as an expression (`=js:…`, and the binding spellings `=vars.x`, `=$vars.x`
300
+ // as well; the C# engine's `ParseEval`, the local engine's
301
+ // `evaluateObjectExpressions`), and one that does not evaluate is null. So it
302
+ // runs, but unchecked, and `=SUM(A1:A3)` or `==== Report ====` reaches the
303
+ // next step as null, not as the text.
304
+ //
305
+ // It looks only where a node evaluates a value (a node type's `expressions()`
306
+ // value sites, `check.ts` `pushLiteralLookalikes`). Deliberately NOT flagged:
307
+ // an `=` inside the text (a URL query string `?a=b`), `{{ name }}` with no
308
+ // `$vars`/`$metadata` in it, `lit(...)` (the explicit literal), and anything
309
+ // that is not a value site — a script body (`code`), an agent prompt,
310
+ // human-task titles and descriptions, a raw node's wire inputs. A subflow
311
+ // input and a `.return()` value are not read either: the builder turns a plain
312
+ // string there into `lit(...)` (`toExpr`), so it cannot be told from one the
313
+ // author wrote on purpose.
314
+ /** A `$vars` / `$metadata` read, as JavaScript spells one. */
315
+ const VARS_MENTION = /\$(?:vars|metadata)\s*[.[]/;
316
+ /** A `{{ … }}` interpolation, as the product's converter finds one (`hasMustacheInterpolation`). */
317
+ const MUSTACHE = /\{\{[^{}]+\}\}/g;
318
+ /** Whether a plain input string looks like an expression the author meant to write as one. */
319
+ export function literalExprShape(text) {
320
+ if (text.startsWith('='))
321
+ return 'wire';
322
+ if (!VARS_MENTION.test(text))
323
+ return undefined;
324
+ return VARS_MENTION.test(text.replace(/\\\{/g, '').replace(MUSTACHE, '')) ? 'text' : 'template';
325
+ }
326
+ /**
327
+ * The finding for one plain string `literalExprShape` matched, worded for `step`.
328
+ * The suggestion is the SDK spelling when the string is exactly one reference
329
+ * (`$vars.s.output.x` or `=vars.s.output.x` → `out('s', 'x')`), or `js` around
330
+ * an `=js:` body.
331
+ */
332
+ export function literalLooksLikeExpr(text, shape, step) {
333
+ const shown = JSON.stringify(text.length > 80 ? `${text.slice(0, 77)}...` : text);
334
+ const unchecked = 'but the SDK never checks it: no reference, syntax or rename check reaches a plain string.';
335
+ const message = shape === 'wire'
336
+ ? `In step "${step}": the plain string ${shown} starts with "=", so the engine evaluates it as an expression `
337
+ + `(null when it does not evaluate), ${unchecked} `
338
+ + 'Write the expression with js`...` (or out(...), input(...), tmpl`...`) so it is checked, '
339
+ + 'or drop the leading "=" if the text is meant.'
340
+ : shape === 'template'
341
+ ? `In step "${step}": the plain string ${shown} reads $vars inside {{ ... }}, which the converter interpolates, ${unchecked} `
342
+ + 'Write it with tmpl`...${out(...)}...` so each reference is checked.'
343
+ : `In step "${step}": the plain string ${shown} looks like an expression, but a plain string is literal text: `
344
+ + 'the flow sends it exactly as written. Write it as an expression (out(...), input(...), js`...` or tmpl`...`), '
345
+ + 'or wrap it in lit(...) if the text really is meant.';
346
+ const body = (text.startsWith('=js:') ? text.slice(4) : text.replace(/^=/, '')).trim()
347
+ .replace(/^(?=(?:vars|metadata)\.)/, () => '$');
348
+ const ref = /^\$vars\.([A-Za-z_$][\w$]*)\.output(?:\.([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*))?$/.exec(body);
349
+ let suggestion;
350
+ if (ref && ref[1] === 'start' && ref[2] && !ref[2].includes('.'))
351
+ suggestion = `input('${ref[2]}')`;
352
+ else if (ref)
353
+ suggestion = ref[2] ? `out('${ref[1]}', '${ref[2]}')` : `out('${ref[1]}')`;
354
+ else if (text.startsWith('=js:') && body && !/[`\\]|\$\{/.test(body))
355
+ suggestion = `js\`${body}\``;
356
+ return { message, ...(suggestion !== undefined ? { suggestion } : {}) };
357
+ }
283
358
  /**
284
359
  * The expression problems `compile` refuses: every error whose code is
285
360
  * `lowering` (`EXPR_SYNTAX`). The serializer throws a {@link FlowBuildError} on
package/dist/merge-cli.js CHANGED
@@ -29,7 +29,12 @@
29
29
  * The original is read as decompile reads it, `$ref`s resolved (decompile-file.ts),
30
30
  * so a split `.flow` merges as one document and is written as one file, as compile
31
31
  * writes it. Written over the original, the files its `$ref`s named are no longer
32
- * read; each is listed (`unreferenced` in `--json`), as merge does not delete files.
32
+ * read, so merge deletes each (`deleted` in `--json`) when the original is in a Flow
33
+ * project (`project.uiproj` at or above it) and no other `.flow` in that project
34
+ * reads it (compared as files, not spellings). One another `.flow` reads is kept
35
+ * (`flow-merge: kept <part>: ...`) and listed nowhere; one merge cannot prove unused
36
+ * (outside a project, an unreadable `.flow`) or could not delete is listed
37
+ * (`unreferenced`), for the caller to delete.
33
38
  *
34
39
  * `--baseline-from <original.flow>` makes merge build the baseline itself
35
40
  * (decompile + compile, nothing written), and an edited `.flow.ts` makes merge
@@ -68,9 +73,11 @@
68
73
  * `SECOND_FLOW_IN_PROJECT` (project-flows.ts).
69
74
  *
70
75
  * Agent resources (#1221): a context or tool the edit adds or changes is written
71
- * beside the merged output too. One the edit REMOVES is listed, one
72
- * `flow-merge: remove <dir>` line each (and `removed` in `--json`), because
73
- * copying the candidate over the project cannot delete a file: delete those
76
+ * beside the merged output too. One the edit REMOVES is deleted when merge
77
+ * writes over the original (`flow-merge: deleted <dir>`, `deleted` in `--json`),
78
+ * unless another `.flow` in the project still uses it (#1995). Written to a
79
+ * candidate elsewhere, or when the host refuses the delete, it is listed instead,
80
+ * one `flow-merge: remove <dir>` line each (`removed` in `--json`): delete those
74
81
  * directories from the project. When the original sits in a Flow project
75
82
  * (`project.uiproj`), the project's `bindings_v2.json` is re-derived from the
76
83
  * merged flow and its agents, as compile does, and written beside the merged
@@ -78,16 +85,16 @@
78
85
  */
79
86
  import { diagnosticLine, reportCompileRefusal, reportDiagnostics, reportResult } from './cli-result.js';
80
87
  import { writeJsonFile } from './core/json-file.js';
81
- import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
88
+ import { existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from 'node:fs';
82
89
  import { inlineAgentResources, mergeBindingsV2, projectBindingRows, refreshInlineAgentRows } from './bindings-v2.js';
83
90
  import { readBindingsV2, readInlineAgentFiles } from './bindings-v2-files.js';
84
91
  import { readSolutionProjects } from './solution-projects-files.js';
85
92
  import { basename, dirname, join, relative, resolve } from 'node:path';
86
93
  import { MergeRefusedError, mergeFlowWithSidecars } from './merge.js';
87
94
  import { sidecarSetFromList } from './merge-sidecars.js';
88
- import { isWithin } from './path-within.js';
95
+ import { isWithin, physicalPath } from './path-within.js';
89
96
  import { flowSources, projectMainFlow, resourceSourcesOfOtherFlows } from './project-resource-users.js';
90
- import { secondFlowWarning } from './project-flows.js';
97
+ import { flowProjectOf, projectFlowFiles, secondFlowWarning } from './project-flows.js';
91
98
  import { flagValue, flagValues, runWhenInvokedDirectly } from './cli-run.js';
92
99
  import { readFlowFile } from './decompile-file.js';
93
100
  import { readFlowStamp, restampFlowSource, sourceDigest, STAMP_MARKER } from './decompile-stamp.js';
@@ -225,6 +232,91 @@ function projectBindings(projectDir, originalPath, mergedFlow, writes, removals)
225
232
  return undefined;
226
233
  return { version: '2.0', ...existing, resources: after };
227
234
  }
235
+ /**
236
+ * Delete `path`, a file or directory merge has just made unreferenced, and
237
+ * answer `undefined`; or leave it and answer why. It must be inside `root` (the
238
+ * original's directory) on disk, links followed (`physicalPath`), and not `root`
239
+ * itself; it must be what merge says it is, not a link; a directory must hold
240
+ * `marker` (a resource directory its `resource.json`).
241
+ */
242
+ function deleteUnreferenced(root, path, kind, marker) {
243
+ let realRoot;
244
+ try {
245
+ realRoot = realpathSync.native(root);
246
+ }
247
+ catch {
248
+ return `${root} could not be read`;
249
+ }
250
+ const at = physicalPath(resolve(path));
251
+ if (at === undefined || at === realRoot || !isWithin(realRoot, at))
252
+ return `it is not inside ${root}`;
253
+ let stat;
254
+ try {
255
+ stat = lstatSync(path);
256
+ }
257
+ catch {
258
+ return 'it is not there';
259
+ }
260
+ if (kind === 'file' ? !stat.isFile() : !stat.isDirectory())
261
+ return `it is not a plain ${kind}`;
262
+ if (marker !== undefined && !existsSync(join(path, marker)))
263
+ return `it holds no ${marker}`;
264
+ try {
265
+ rmSync(path, { recursive: kind === 'directory', force: true });
266
+ }
267
+ catch (error) {
268
+ return error instanceof Error ? error.message : String(error);
269
+ }
270
+ return undefined;
271
+ }
272
+ /**
273
+ * The file a path names on disk, as `dev:ino`, or `undefined` when it cannot be
274
+ * read. Two spellings of one file (`NODES.json` and `nodes.json` on a
275
+ * case-insensitive file system, a link and its target) give one key.
276
+ */
277
+ function fileKey(path) {
278
+ try {
279
+ const st = statSync(path, { bigint: true });
280
+ return `${st.dev}:${st.ino}`;
281
+ }
282
+ catch {
283
+ return undefined;
284
+ }
285
+ }
286
+ /**
287
+ * The files the `$ref`s of every OTHER `.flow` file below `dir` (the Flow
288
+ * project's root) read, every subfolder included (`sub/Q.flow` may read
289
+ * `./nodes.json`, the file `P.flow` names as `./sub/nodes.json`; `Q.flow` at the
290
+ * root may read `./flows/nodes.json`), each as {@link fileKey}. `undefined` when merge cannot be
291
+ * sure: a `.flow` there cannot be read, or the folder is larger than the scan
292
+ * reads (`projectFlowFiles`' bounds). Then no part file is provably unused.
293
+ * The walk is `projectFlowFiles` in project-flows.ts, entering dot-folders and
294
+ * nested projects: a `$ref` can come from any of them.
295
+ */
296
+ function partsOfOtherFlows(dir, self) {
297
+ const { files, complete } = projectFlowFiles(dir, { readers: false });
298
+ if (!complete)
299
+ return undefined;
300
+ const selfKey = fileKey(self);
301
+ const keys = new Set();
302
+ for (const path of files) {
303
+ if (fileKey(path) === selfKey)
304
+ continue;
305
+ const parts = [];
306
+ try {
307
+ readFlowFile(path, parts);
308
+ }
309
+ catch {
310
+ return undefined;
311
+ }
312
+ for (const part of parts) {
313
+ const key = fileKey(part);
314
+ if (key !== undefined)
315
+ keys.add(key);
316
+ }
317
+ }
318
+ return keys;
319
+ }
228
320
  /** A JSON file's contents, or `undefined` when it is missing or unreadable. */
229
321
  function readJsonOrUndefined(path) {
230
322
  try {
@@ -542,19 +634,86 @@ export async function run(argv) {
542
634
  console.log(`flow-merge: kept ${rel}: ${user} still references it`);
543
635
  return user === undefined;
544
636
  });
545
- const removed = removals.map((rel) => join(originalDir, rel));
546
- for (const dir of removed) {
547
- console.log(inPlace
548
- ? `flow-merge: remove ${dir} from the project: the edit removed this agent resource, and merge does not delete files`
549
- : `flow-merge: remove ${dir} from the project: the edit removed this agent resource, and copying the candidate cannot delete it`);
637
+ // Derived before anything is deleted: a removed resource's row is matched by
638
+ // the body read from its file.
639
+ const bindingsV2 = projectBindings(originalDir, originalPath, flow, merged.sidecars, removals);
640
+ // Written over the original, merge deletes what it has just made unreferenced
641
+ // itself (#1995): each agent resource directory the edit removed, and, for a
642
+ // split original now written as one file, its part files. Only paths it can
643
+ // prove are unreferenced, and only inside the original's directory
644
+ // (`deleteUnreferenced`). Written elsewhere (a candidate), the project is not
645
+ // touched, so they are listed for the caller to delete, as before. What it
646
+ // could not delete (a host that refuses deletes) is listed the same way.
647
+ const deleted = [];
648
+ const removed = [];
649
+ const mergedSources = new Set(flowSources(flow).map((s) => s.toLowerCase()));
650
+ for (const rel of removals) {
651
+ const dir = join(originalDir, rel);
652
+ if (!inPlace) {
653
+ removed.push(dir);
654
+ console.log(`flow-merge: remove ${dir} from the project: the edit removed this agent resource, and copying the candidate cannot delete it`);
655
+ continue;
656
+ }
657
+ // In use: kept, and not listed under `remove`, which the caller deletes.
658
+ if (mergedSources.has(basename(rel).toLowerCase())) {
659
+ console.log(`flow-merge: kept ${rel}: ${basename(out)} still names it`);
660
+ continue;
661
+ }
662
+ const refusal = deleteUnreferenced(originalDir, dir, 'directory', 'resource.json');
663
+ if (refusal === undefined) {
664
+ deleted.push(resolve(dir));
665
+ console.log(`flow-merge: deleted ${dir}: the edit removed this agent resource`);
666
+ }
667
+ else {
668
+ removed.push(dir);
669
+ console.log(`flow-merge: remove ${dir} from the project: the edit removed this agent resource, and merge did not delete it (${refusal})`);
670
+ }
550
671
  }
551
672
  // Written over a split original, the merged flow is one file, so its part files
552
- // stay on disk with nothing reading them.
553
- const unreferenced = inPlace ? originalParts : [];
554
- for (const part of unreferenced) {
555
- console.log(`flow-merge: remove ${part} from the project: ${basename(originalPath)} is now one file and no longer references it, and merge does not delete files`);
673
+ // stay on disk with nothing reading them, unless another .flow in the project reads one.
674
+ const unreferenced = [];
675
+ if (inPlace && originalParts.length > 0) {
676
+ // A reader of a part can sit anywhere in the project, above the original's folder
677
+ // too (`Q.flow` reading `./flows/nodes.json`), so the scan starts at the Flow
678
+ // project's root. Outside a project there is no top to start from: nothing is
679
+ // deleted, every part is listed.
680
+ // Found from where the original IS on disk, links followed: opened through a link
681
+ // (`ws/alias -> real/proj/flows`), the typed path climbs to a project.uiproj
682
+ // that is not the original's. A project inside another one (`Outer/Inner/`)
683
+ // can have a reader above it (`Outer/Q.flow` reading `./Inner/nodes.json`), so
684
+ // that is treated as no top either.
685
+ const real = physicalPath(resolve(originalPath));
686
+ const found = real === undefined ? undefined : flowProjectOf(real);
687
+ // `flowProjectOf` climbs from its argument's folder, so passing the project folder
688
+ // itself starts the climb at its parent.
689
+ const nested = found !== undefined && flowProjectOf(found) !== undefined;
690
+ const project = nested ? undefined : found;
691
+ const sharedParts = project === undefined ? undefined : partsOfOtherFlows(project, real ?? resolve(originalPath));
692
+ for (const part of originalParts) {
693
+ // Proven in use, or a deliverable itself: kept, and NOT listed under `remove`
694
+ // (the caller deletes every `remove` line, which would break the other flow).
695
+ const inUse = part.endsWith('.flow') ? 'it is a .flow file'
696
+ : sharedParts?.has(fileKey(part) ?? part) ? 'another .flow in the project still references it'
697
+ : undefined;
698
+ if (inUse !== undefined) {
699
+ console.log(`flow-merge: kept ${part}: ${inUse}`);
700
+ continue;
701
+ }
702
+ // Not provably unused, or the delete failed: listed for the caller, as on main.
703
+ const refusal = nested ? `${basename(originalPath)}'s Flow project sits inside another one, so a .flow above it may use the file`
704
+ : project === undefined ? `${basename(originalPath)} is in no Flow project (no project.uiproj above it), so merge cannot read every .flow that may use the file`
705
+ : sharedParts === undefined ? 'merge could not read every .flow in the project, so it cannot tell whether one uses the file'
706
+ : deleteUnreferenced(originalDir, part, 'file');
707
+ if (refusal === undefined) {
708
+ deleted.push(part);
709
+ console.log(`flow-merge: deleted ${part}: ${basename(originalPath)} is now one file and no longer references it`);
710
+ }
711
+ else {
712
+ unreferenced.push(part);
713
+ console.log(`flow-merge: remove ${part} from the project: ${basename(originalPath)} is now one file and no longer references it, and merge did not delete it (${refusal})`);
714
+ }
715
+ }
556
716
  }
557
- const bindingsV2 = projectBindings(originalDir, originalPath, flow, merged.sidecars, removals);
558
717
  if (bindingsV2 !== undefined) {
559
718
  writeJsonFile(join(outDir, 'bindings_v2.json'), bindingsV2);
560
719
  console.log('flow-merge: wrote bindings_v2.json (connection and agent resource rows, re-derived as compile does)');
@@ -597,6 +756,7 @@ export async function run(argv) {
597
756
  edges: (flow.edges ?? []).length,
598
757
  ...(stamp ? { baseline: baselinePath ? 'file' : 'derived', restamped } : {}),
599
758
  ...(targets.length > 0 ? { sidecars: targets.map((t) => t.target) } : {}),
759
+ ...(deleted.length > 0 ? { deleted } : {}),
600
760
  ...(removed.length > 0 ? { removed } : {}),
601
761
  ...(unreferenced.length > 0 ? { unreferenced } : {}),
602
762
  ...(bindingsV2 !== undefined ? { bindings: join(resolve(outDir), 'bindings_v2.json') } : {}),
@@ -0,0 +1,24 @@
1
+ /** One path the cleanup removed or left, with why. */
2
+ export interface PipelineArtifact {
3
+ /** Absolute path. */
4
+ path: string;
5
+ /** What it was (removed), or why it stayed (kept). */
6
+ reason: string;
7
+ }
8
+ /**
9
+ * Remove the earlier loop's compiled artifacts for the flow `name` from
10
+ * `workDir`. Does nothing unless `workDir` is the SDK's work directory
11
+ * (`.flow-sdk`). Never throws: what it cannot read or remove is `kept`.
12
+ *
13
+ * @example
14
+ * // .flow-sdk/ holds Order.flow.ts, Order.merged.flow and Order.baseline/Order.flow
15
+ * clearPipelineArtifacts('.flow-sdk', 'Order')
16
+ * // → removed: [.flow-sdk/Order.merged.flow, .flow-sdk/Order.baseline], kept: []
17
+ */
18
+ export declare function clearPipelineArtifacts(workDir: string, name: string, options?: {
19
+ keep?: readonly string[];
20
+ original?: unknown;
21
+ }): {
22
+ removed: PipelineArtifact[];
23
+ kept: PipelineArtifact[];
24
+ };
@@ -0,0 +1,228 @@
1
+ /**
2
+ * pipeline-artifacts — the compiled leftovers of an earlier brownfield loop for
3
+ * one flow, which a fresh `flow decompile` of that flow clears (#1995).
4
+ *
5
+ * Every brownfield loop the SDK has generated or documented compiles `.flow`
6
+ * files into the work directory (`.flow-sdk/`, workdir.ts) beside the source:
7
+ *
8
+ * .flow-sdk/Order.baseline/Order.flow the pipeline's baseline compile
9
+ * .flow-sdk/Order.edited/Order.flow the pipeline's edited compile
10
+ * .flow-sdk/Order.merged.flow the pipeline's merge candidate
11
+ * .flow-sdk/<uuid>/agent.json an inline agent merge wrote beside it
12
+ * .flow-sdk/Order.baseline.flow the same, as a pipeline before #1207 named them
13
+ * .flow-sdk/baseline/Order.flow the by-hand loop the guides taught
14
+ *
15
+ * Inside a Flow project each of those `.flow` files is one more deliverable to
16
+ * product validation, which reads every `.flow` below the project, hidden
17
+ * folders included. A new decompile writes a new source, so a baseline compiled
18
+ * from the old one is stale anyway: the next loop must compile its own. So
19
+ * decompile removes them, instead of every guide carrying a `find … -exec rm`.
20
+ *
21
+ * Only what is provably this flow's is removed, and only inside the work
22
+ * directory:
23
+ *
24
+ * - a FILE by its exact name (`<Name>.merged.flow`, ...), never a link;
25
+ * - a DIRECTORY by its exact name, and only when it holds nothing but
26
+ * `<Name>.flow` and agent folders (`<uuid>/`), as a compile writes it; one
27
+ * holding anything else is kept and reported;
28
+ * - an agent folder at the top of the work directory only when a removed
29
+ * `.flow` names it as an agent `source` and no `.flow` that stays does.
30
+ *
31
+ * Never removed: a `<Name>.merged.flow` that differs from the flow being
32
+ * decompiled (`options.original`), which may hold the only copy of an edit not yet
33
+ * applied; the file the decompile read, or a folder holding it
34
+ * (`options.keep`): `flow decompile .flow-sdk/Order.merged.flow` looks at the
35
+ * candidate, it does not start a new loop over it.
36
+ *
37
+ * Library module (FB010): it returns what it did, and the CLI prints it.
38
+ */
39
+ import { lstatSync, readdirSync, readFileSync, realpathSync, rmSync } from 'node:fs';
40
+ import { basename, join, resolve } from 'node:path';
41
+ import { isWithin, physicalPath } from './path-within.js';
42
+ import { flowSources } from './project-resource-users.js';
43
+ import { WORK_DIR } from './workdir.js';
44
+ /** An agent folder name: a uuid, any case. */
45
+ const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
46
+ /** The files a loop wrote for `name`, each with what it was. */
47
+ function candidateFiles(name) {
48
+ return [
49
+ [`${name}.merged.flow`, 'an earlier merge candidate'],
50
+ [`${name}.baseline.flow`, 'an earlier baseline compile'],
51
+ [`${name}.edited.flow`, 'an earlier edited compile'],
52
+ ];
53
+ }
54
+ /** The directories a loop compiled `name` into, each with what it was. */
55
+ function candidateDirs(name) {
56
+ return [
57
+ [`${name}.baseline`, 'an earlier baseline compile'],
58
+ [`${name}.edited`, 'an earlier edited compile'],
59
+ ['baseline', 'an earlier baseline compile'],
60
+ ['edited', 'an earlier edited compile'],
61
+ ];
62
+ }
63
+ /**
64
+ * Remove the earlier loop's compiled artifacts for the flow `name` from
65
+ * `workDir`. Does nothing unless `workDir` is the SDK's work directory
66
+ * (`.flow-sdk`). Never throws: what it cannot read or remove is `kept`.
67
+ *
68
+ * @example
69
+ * // .flow-sdk/ holds Order.flow.ts, Order.merged.flow and Order.baseline/Order.flow
70
+ * clearPipelineArtifacts('.flow-sdk', 'Order')
71
+ * // → removed: [.flow-sdk/Order.merged.flow, .flow-sdk/Order.baseline], kept: []
72
+ */
73
+ export function clearPipelineArtifacts(workDir, name, options = {}) {
74
+ const removed = [];
75
+ const kept = [];
76
+ if (basename(workDir) !== WORK_DIR || name === '' || name !== basename(name))
77
+ return { removed, kept };
78
+ let root;
79
+ let entries;
80
+ try {
81
+ root = realpathSync.native(workDir);
82
+ entries = readdirSync(workDir, { withFileTypes: true });
83
+ }
84
+ catch {
85
+ return { removed, kept };
86
+ }
87
+ const byName = new Map(entries.map((e) => [e.name, e]));
88
+ /** Remove `path` (a plain file or folder in the work directory), recording the outcome. */
89
+ // Where each kept path lands on disk, so a candidate that IS one, or holds one,
90
+ // is never removed whatever spelling or link reached it.
91
+ const keep = (options.keep ?? []).map((p) => physicalPath(resolve(p))).filter((p) => p !== undefined);
92
+ const remove = (path, reason) => {
93
+ const at = physicalPath(path);
94
+ if (at === undefined || at === root || !isWithin(root, at)) {
95
+ kept.push({ path, reason: `not inside ${workDir}` });
96
+ return false;
97
+ }
98
+ if (keep.some((k) => isWithin(at, k))) {
99
+ kept.push({ path, reason: 'it is, or holds, the file this decompile read' });
100
+ return false;
101
+ }
102
+ try {
103
+ rmSync(path, { recursive: true, force: true });
104
+ }
105
+ catch (error) {
106
+ kept.push({ path, reason: `could not remove it (${error instanceof Error ? error.message : String(error)})` });
107
+ return false;
108
+ }
109
+ removed.push({ path, reason });
110
+ return true;
111
+ };
112
+ // Agent folders a removed top-level `.flow` names; removed below once nothing that stays names them.
113
+ const named = new Set();
114
+ for (const [file, reason] of candidateFiles(name)) {
115
+ const entry = byName.get(file);
116
+ if (!entry?.isFile())
117
+ continue; // absent, a folder, or a link: not ours
118
+ const path = join(workDir, file);
119
+ const json = readJson(path);
120
+ // A merge candidate that differs from the original being decompiled holds an
121
+ // edit nobody has applied yet: decompile has just overwritten the source, so it
122
+ // may be the last copy of that edit. Kept until it matches (it was copied over).
123
+ if (file === `${name}.merged.flow` && !(json !== undefined && sameDocument(json, options.original))) {
124
+ kept.push({ path, reason: `it differs from the flow this decompile read, so it may be an unapplied merge candidate: copy it over the original or delete it yourself` });
125
+ continue;
126
+ }
127
+ const sources = flowSources(json);
128
+ if (remove(path, reason))
129
+ for (const s of sources)
130
+ if (UUID.test(s))
131
+ named.add(s);
132
+ }
133
+ for (const [dir, reason] of candidateDirs(name)) {
134
+ const entry = byName.get(dir);
135
+ if (!entry?.isDirectory())
136
+ continue;
137
+ const path = join(workDir, dir);
138
+ const stray = strayEntry(path, name);
139
+ if (stray !== undefined) {
140
+ kept.push({ path, reason: stray });
141
+ continue;
142
+ }
143
+ remove(path, reason);
144
+ }
145
+ if (named.size > 0) {
146
+ // A `.flow` that stays (another flow's candidate) may share the folder.
147
+ const stillNamed = new Set();
148
+ for (const e of readdirSafe(workDir)) {
149
+ if (e.isFile() && e.name.endsWith('.flow'))
150
+ for (const s of flowSources(readJson(join(workDir, e.name))))
151
+ stillNamed.add(s.toLowerCase());
152
+ }
153
+ for (const source of [...named].sort()) {
154
+ const entry = byName.get(source);
155
+ if (!entry?.isDirectory())
156
+ continue;
157
+ const path = join(workDir, source);
158
+ if (stillNamed.has(source.toLowerCase())) {
159
+ kept.push({ path, reason: 'another .flow in the work directory still names it' });
160
+ continue;
161
+ }
162
+ if (!isPlainFile(join(path, 'agent.json'))) {
163
+ kept.push({ path, reason: 'it holds no agent.json, so it is not an agent folder merge wrote' });
164
+ continue;
165
+ }
166
+ remove(path, 'the agent folder an earlier merge candidate named');
167
+ }
168
+ }
169
+ return { removed, kept };
170
+ }
171
+ /**
172
+ * Why the folder at `dir` is not a compile of `name`, or `undefined` when it
173
+ * is: it holds `<name>.flow` and otherwise only agent folders.
174
+ */
175
+ function strayEntry(dir, name) {
176
+ let entries;
177
+ try {
178
+ entries = readdirSync(dir, { withFileTypes: true });
179
+ }
180
+ catch (error) {
181
+ return `could not read it (${error instanceof Error ? error.message : String(error)})`;
182
+ }
183
+ const flow = `${name}.flow`;
184
+ if (!entries.some((e) => e.isFile() && e.name === flow))
185
+ return `it holds no ${flow}, so it is not this flow's compile`;
186
+ const other = entries.find((e) => !(e.isFile() && e.name === flow) && !(e.isDirectory() && UUID.test(e.name)));
187
+ return other === undefined ? undefined : `it holds ${other.name}, which a compile of ${name} does not write`;
188
+ }
189
+ function readdirSafe(dir) {
190
+ try {
191
+ return readdirSync(dir, { withFileTypes: true });
192
+ }
193
+ catch {
194
+ return [];
195
+ }
196
+ }
197
+ /** `path` is a file itself, not a link to one. */
198
+ function isPlainFile(path) {
199
+ try {
200
+ return lstatSync(path).isFile();
201
+ }
202
+ catch {
203
+ return false;
204
+ }
205
+ }
206
+ /** `a` and `b` are the same JSON document, whatever the order of each object's keys. */
207
+ function sameDocument(a, b) {
208
+ if (a === b)
209
+ return true;
210
+ if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null)
211
+ return false;
212
+ if (Array.isArray(a) !== Array.isArray(b))
213
+ return false;
214
+ if (Array.isArray(a))
215
+ return a.length === b.length && a.every((x, i) => sameDocument(x, b[i]));
216
+ const ka = Object.keys(a);
217
+ const kb = Object.keys(b);
218
+ return ka.length === kb.length && ka.every((k) => Object.prototype.hasOwnProperty.call(b, k)
219
+ && sameDocument(a[k], b[k]));
220
+ }
221
+ function readJson(path) {
222
+ try {
223
+ return JSON.parse(readFileSync(path, 'utf8'));
224
+ }
225
+ catch {
226
+ return undefined;
227
+ }
228
+ }
@@ -24,6 +24,31 @@ export declare function otherProjectFlows(file: string): {
24
24
  project: string | undefined;
25
25
  others: string[];
26
26
  };
27
+ /**
28
+ * Every `.flow` file below `root` (absolute paths), read breadth-first within
29
+ * {@link MAX_DEPTH} levels and {@link MAX_DIRS} folders, links not followed,
30
+ * `node_modules/` skipped. The one walk of a project's `.flow` files.
31
+ *
32
+ * - `readers: true` reads what a project's readers read (see the module
33
+ * comment): dot-folders and nested projects are skipped.
34
+ * - `readers: false` reads everything a `$ref` could come from: dot-folders and
35
+ * nested projects included (`.git/` still skipped). Merge uses it to prove no
36
+ * `.flow` reads a part file before deleting it.
37
+ *
38
+ * `complete` is `false` when the walk stopped at a bound, could not read a
39
+ * folder, or (`readers: false`) met a link to a folder or a `.flow`, which it
40
+ * does not follow: a caller that must prove an absence fails closed on it.
41
+ *
42
+ * @example
43
+ * projectFlowFiles('/s/Order', { readers: true })
44
+ * // { files: ['/s/Order/Order.flow', '/s/Order/backup/Order.flow'], complete: true }
45
+ */
46
+ export declare function projectFlowFiles(root: string, options: {
47
+ readers: boolean;
48
+ }): {
49
+ files: string[];
50
+ complete: boolean;
51
+ };
27
52
  /**
28
53
  * The `SECOND_FLOW_IN_PROJECT` warning for writing `file`, or `undefined` when
29
54
  * its project holds no other `.flow` a reader sees, or `file` itself sits where
@@ -35,7 +35,7 @@
35
35
  *
36
36
  * Library module (FB010): it returns the files, and the CLIs print the warning.
37
37
  */
38
- import { existsSync, readdirSync } from 'node:fs';
38
+ import { existsSync, readdirSync, statSync } from 'node:fs';
39
39
  import { dirname, join, relative, resolve } from 'node:path';
40
40
  /** How many folder levels below the project the scan reads. */
41
41
  export const MAX_DEPTH = 8;
@@ -76,10 +76,36 @@ export function otherProjectFlows(file) {
76
76
  if (project === undefined)
77
77
  return { project, others: [] };
78
78
  const self = resolve(file);
79
- const others = [];
80
- const queue = [{ dir: project, depth: 0 }];
79
+ const { files } = projectFlowFiles(project, { readers: true });
80
+ return { project, others: files.filter((f) => f !== self).map((f) => relative(project, f)).sort() };
81
+ }
82
+ /**
83
+ * Every `.flow` file below `root` (absolute paths), read breadth-first within
84
+ * {@link MAX_DEPTH} levels and {@link MAX_DIRS} folders, links not followed,
85
+ * `node_modules/` skipped. The one walk of a project's `.flow` files.
86
+ *
87
+ * - `readers: true` reads what a project's readers read (see the module
88
+ * comment): dot-folders and nested projects are skipped.
89
+ * - `readers: false` reads everything a `$ref` could come from: dot-folders and
90
+ * nested projects included (`.git/` still skipped). Merge uses it to prove no
91
+ * `.flow` reads a part file before deleting it.
92
+ *
93
+ * `complete` is `false` when the walk stopped at a bound, could not read a
94
+ * folder, or (`readers: false`) met a link to a folder or a `.flow`, which it
95
+ * does not follow: a caller that must prove an absence fails closed on it.
96
+ *
97
+ * @example
98
+ * projectFlowFiles('/s/Order', { readers: true })
99
+ * // { files: ['/s/Order/Order.flow', '/s/Order/backup/Order.flow'], complete: true }
100
+ */
101
+ export function projectFlowFiles(root, options) {
102
+ const files = [];
103
+ let complete = true;
104
+ const queue = [{ dir: root, depth: 0 }];
81
105
  let read = 0;
82
- while (queue.length > 0 && read < MAX_DIRS) {
106
+ while (queue.length > 0) {
107
+ if (read >= MAX_DIRS)
108
+ return { files, complete: false };
83
109
  const { dir, depth } = queue.shift();
84
110
  read++;
85
111
  let entries;
@@ -87,20 +113,42 @@ export function otherProjectFlows(file) {
87
113
  entries = readdirSync(dir, { withFileTypes: true });
88
114
  }
89
115
  catch {
116
+ complete = false;
90
117
  continue;
91
118
  }
92
119
  for (const e of entries) {
93
120
  const path = join(dir, e.name);
121
+ if (e.isSymbolicLink()) {
122
+ // Not followed. A link to a folder or a `.flow` hides what it leads to, so
123
+ // a walk that must see every `.flow` is incomplete (a dangling `.flow` link too).
124
+ if (!options.readers && (e.name.endsWith('.flow') || linksToFolder(path)))
125
+ complete = false;
126
+ continue;
127
+ }
94
128
  if (e.isFile() && e.name.endsWith('.flow')) {
95
- if (path !== self)
96
- others.push(relative(project, path));
129
+ files.push(path);
97
130
  }
98
- else if (e.isDirectory() && !e.name.startsWith('.') && !SKIPPED.has(e.name) && depth < MAX_DEPTH && !existsSync(join(path, 'project.uiproj'))) {
131
+ else if (e.isDirectory() && !SKIPPED.has(e.name) && e.name !== '.git') {
132
+ if (options.readers && (e.name.startsWith('.') || existsSync(join(path, 'project.uiproj'))))
133
+ continue;
134
+ if (depth >= MAX_DEPTH) {
135
+ complete = false;
136
+ continue;
137
+ }
99
138
  queue.push({ dir: path, depth: depth + 1 });
100
139
  }
101
140
  }
102
141
  }
103
- return { project, others: others.sort() };
142
+ return { files, complete };
143
+ }
144
+ /** `path` (a link) leads to a folder. */
145
+ function linksToFolder(path) {
146
+ try {
147
+ return statSync(path).isDirectory();
148
+ }
149
+ catch {
150
+ return false;
151
+ }
104
152
  }
105
153
  /** A project-relative path inside a folder the scan does not read (a dot-folder, `node_modules/`). */
106
154
  function unread(rel) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.110.0",
3
+ "version": "6.112.0",
4
4
  "description": "Build UiPath Flow, Case, and BPMN artifacts by writing TypeScript.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://docs.uipath.com/maestro",
@@ -123,5 +123,5 @@
123
123
  "@types/node": "^22.7.0",
124
124
  "esbuild": "^0.28.1"
125
125
  },
126
- "gitref": "0a9aff796fc17366d91e10f723108adb494d09b4"
126
+ "gitref": "72462b008146a6ae13a27ee816f6a82f43307191"
127
127
  }