@saptools/service-flow 0.1.45 → 0.1.46

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/cli.js CHANGED
@@ -3,6 +3,7 @@ import {
3
3
  classifyODataPathIntent,
4
4
  containsSupportedOutboundCall,
5
5
  discoverRepositories,
6
+ implementationHintSuggestions,
6
7
  linkWorkspace,
7
8
  normalizeODataOperationInvocationPath,
8
9
  normalizePath,
@@ -14,7 +15,7 @@ import {
14
15
  parsePackageJson,
15
16
  parseServiceBindings,
16
17
  trace
17
- } from "./chunk-BXSCE5CR.js";
18
+ } from "./chunk-EGY2A4AT.js";
18
19
 
19
20
  // src/cli.ts
20
21
  import { Command } from "commander";
@@ -210,7 +211,7 @@ function migrate(db) {
210
211
  // package.json
211
212
  var package_default = {
212
213
  name: "@saptools/service-flow",
213
- version: "0.1.45",
214
+ version: "0.1.46",
214
215
  description: "Trace SAP CAP service-to-service flows across multi-repository workspaces with runtime-aware graph resolution",
215
216
  type: "module",
216
217
  publishConfig: {
@@ -1479,6 +1480,7 @@ function implementationEdgeCategories(db, detail) {
1479
1480
  ...item,
1480
1481
  servicePathPattern: pathPattern(servicePaths),
1481
1482
  suggestedAction: categoryAction(String(item.category)),
1483
+ suggestedHints: suggestedHints(item.examples),
1482
1484
  examples: item.examples.slice(0, 3),
1483
1485
  expandedExamples: detail ? item.examples : void 0
1484
1486
  }));
@@ -1491,11 +1493,22 @@ function addImplementationCategory(grouped, row) {
1491
1493
  const baseOperation = String(row.baseOperation ?? row.operationName ?? evidence.operationName ?? "unknown");
1492
1494
  const key = [category, baseOperation, reason, family].join("\0");
1493
1495
  const current = grouped.get(key) ?? { category, baseOperation, reason, candidateFamily: family, count: 0, servicePaths: [], examples: [] };
1496
+ const hintSuggestions = implementationSuggestions(evidence);
1494
1497
  current.count += 1;
1495
1498
  current.servicePaths.push(String(row.servicePath ?? evidence.servicePath ?? ""));
1496
- current.examples.push({ servicePath: row.servicePath, operation: row.operationName, status: row.status, reason: row.unresolvedReason });
1499
+ current.examples.push({ servicePath: row.servicePath, operation: row.operationName, status: row.status, reason: row.unresolvedReason, implementationHintSuggestions: hintSuggestions });
1497
1500
  grouped.set(key, current);
1498
1501
  }
1502
+ function implementationSuggestions(evidence) {
1503
+ const persisted = asRecords(evidence.implementationHintSuggestions);
1504
+ const suggestions = persisted.length ? persisted : implementationHintSuggestions(evidence);
1505
+ return suggestions.length ? suggestions : void 0;
1506
+ }
1507
+ function suggestedHints(examples) {
1508
+ const hints = examples.flatMap((example) => asRecords(example.implementationHintSuggestions).flatMap((suggestion) => typeof suggestion.cli === "string" ? [String(suggestion.cli)] : []));
1509
+ const unique = [...new Set(hints)].slice(0, 3);
1510
+ return unique.length ? unique : void 0;
1511
+ }
1499
1512
  function missingParameterMetadataCategory(db, detail = false) {
1500
1513
  const examples = db.prepare(`SELECT sc.source_file sourceFile,sc.source_line sourceLine,sc.callee_expression calleeExpression
1501
1514
  FROM symbol_calls sc JOIN symbols s ON s.id=sc.callee_symbol_id
@@ -1712,11 +1725,24 @@ function renderTraceTable(result) {
1712
1725
  const lines = ["Step Type From To Evidence"];
1713
1726
  for (const e of result.edges) {
1714
1727
  lines.push(`${String(e.step).padEnd(5)} ${e.type.padEnd(20)} ${e.from.slice(0, 34).padEnd(35)} ${e.to.slice(0, 35).padEnd(36)} ${location(e.evidence)}`);
1728
+ const hint = firstHint(e.evidence);
1729
+ if (e.unresolvedReason && hint) lines.push(` try ${hint}`);
1715
1730
  }
1716
- if (result.diagnostics.length > 0) lines.push("", "Diagnostics:", ...result.diagnostics.map((d) => `${String(d.severity ?? "info")} ${String(d.code ?? "diagnostic")} ${String(d.message ?? "")}`));
1731
+ if (result.diagnostics.length > 0) lines.push("", "Diagnostics:", ...result.diagnostics.flatMap(diagnosticLines));
1717
1732
  return `${lines.join("\n")}
1718
1733
  `;
1719
1734
  }
1735
+ function diagnosticLines(diagnostic) {
1736
+ const first = `${String(diagnostic.severity ?? "info")} ${String(diagnostic.code ?? "diagnostic")} ${String(diagnostic.message ?? "")}`;
1737
+ const hint = firstHint(diagnostic);
1738
+ return hint ? [first, ` try ${hint}`] : [first];
1739
+ }
1740
+ function firstHint(evidence) {
1741
+ const suggestions = evidence.implementationHintSuggestions;
1742
+ if (!Array.isArray(suggestions)) return void 0;
1743
+ const first = suggestions.find((item) => Boolean(item) && typeof item === "object");
1744
+ return typeof first?.cli === "string" ? first.cli : void 0;
1745
+ }
1720
1746
 
1721
1747
  // src/output/json-output.ts
1722
1748
  function renderJson(value) {