@xand0dev/traceflow 0.2.0 → 0.2.1

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
@@ -11049,7 +11049,9 @@ function computeDiff(base, cur, since, firstSeen) {
11049
11049
  pageLabel,
11050
11050
  (b, a) => {
11051
11051
  if (!a) return [];
11052
- const { added, removed } = setDiff(b?.calls.map((c) => `${c.method} ${c.endpoint.slice(3)}`) ?? [], a.calls.map((c) => `${c.method} ${c.endpoint.slice(3)}`));
11052
+ const pathOf = (id) => cur.endpoints.find((e) => e.id === id)?.path ?? base.endpoints.find((e) => e.id === id)?.path ?? id.slice(3);
11053
+ const sig = (p) => p?.calls.map((c) => `${c.method} ${pathOf(c.endpoint)}`) ?? [];
11054
+ const { added, removed } = setDiff(sig(b), sig(a));
11053
11055
  return [...added.map((x) => `+ calls ${x}`), ...removed.map((x) => `\u2212 no longer calls ${x}`)];
11054
11056
  },
11055
11057
  (p) => ({ file: p.file, line: p.line })
@@ -41038,7 +41040,7 @@ async function runMcp(root2, port2, telemetryPort2) {
41038
41040
  };
41039
41041
  const text = (t) => ({ content: [{ type: "text", text: t }] });
41040
41042
  const server = new McpServer(
41041
- { name: "traceflow", version: "0.2.0" },
41043
+ { name: "traceflow", version: "0.2.1" },
41042
41044
  {
41043
41045
  instructions: "TraceFlow knows this project's architecture: frontend pages, the API endpoints they call, the models those endpoints use, and live HTTP traffic. Use `architecture` before exploring an unfamiliar codebase, `trace` to find where an endpoint lives and who calls it, `changes` after editing to summarize what moved in the architecture, and `traffic` when debugging failed requests. Tell the user they can watch the live map with `open_map`."
41044
41046
  }
package/dist/parser.py CHANGED
@@ -40,6 +40,17 @@ def walk(root: str):
40
40
  yield dirpath, files
41
41
 
42
42
 
43
+ def walk_project(root: str):
44
+ """Like walk(), but stays inside one JS project: folders with their own package.json are other projects."""
45
+ for dirpath, dirs, files in os.walk(root):
46
+ dirs[:] = [
47
+ d for d in dirs
48
+ if d not in SKIP_DIRS and not d.startswith(".")
49
+ and not os.path.exists(os.path.join(dirpath, d, "package.json"))
50
+ ]
51
+ yield dirpath, files
52
+
53
+
43
54
  def rel(path: str, root: str) -> str:
44
55
  return os.path.relpath(path, root).replace(os.sep, "/")
45
56
 
@@ -480,7 +491,7 @@ def local_imports(path: str) -> list[str]:
480
491
 
481
492
  def index_components(root: str) -> dict[str, str]:
482
493
  comps: dict[str, str] = {}
483
- for dirpath, files in walk(root):
494
+ for dirpath, files in walk_project(root):
484
495
  for f in files:
485
496
  if f.endswith(JS_EXT) and not f.endswith(".d.ts"):
486
497
  comps.setdefault(f.rsplit(".", 1)[0], os.path.join(dirpath, f))
@@ -498,7 +509,7 @@ _WRAPPERS = {"Navigate", "Layout", "Suspense", "Outlet", "PrivateRoute", "Protec
498
509
  def parse_web_pages(root: str, comps: dict[str, str]) -> list[dict[str, Any]]:
499
510
  pages: list[dict[str, Any]] = []
500
511
  seen: set[str] = set()
501
- for dirpath, files in walk(root):
512
+ for dirpath, files in walk_project(root):
502
513
  for f in files:
503
514
  if not f.endswith(JS_EXT):
504
515
  continue
@@ -556,7 +567,7 @@ _SCREEN = re.compile(
556
567
  def parse_rn_screens(root: str, comps: dict[str, str]) -> list[dict[str, Any]]:
557
568
  screens: list[dict[str, Any]] = []
558
569
  seen: set[str] = set()
559
- for dirpath, files in walk(root):
570
+ for dirpath, files in walk_project(root):
560
571
  for f in files:
561
572
  if not f.endswith(JS_EXT):
562
573
  continue
@@ -728,7 +739,7 @@ def scan(target: str) -> dict[str, Any]:
728
739
 
729
740
  # API calls in files no page imports (hooks, stores, services) belong to the app itself
730
741
  app_calls = []
731
- for dirpath, files in walk(fe["root"]):
742
+ for dirpath, files in walk_project(fe["root"]):
732
743
  for f in files:
733
744
  path = os.path.join(dirpath, f)
734
745
  if not f.endswith(JS_EXT) or path in attributed:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xand0dev/traceflow",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "See what your AI is building: a live architecture map, what the agent changed, and real traffic from web to API to database.",
5
5
  "keywords": [
6
6
  "mcp",