next-arch-map 0.1.28 → 0.1.29

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 (2) hide show
  1. package/dist/serve.js +18 -0
  2. package/package.json +1 -1
package/dist/serve.js CHANGED
@@ -3,6 +3,7 @@ import http from "node:http";
3
3
  import path from "node:path";
4
4
  import chokidar from "chokidar";
5
5
  import { analyzeProject } from "./index.js";
6
+ import { generateDescribeContext } from "./describe.js";
6
7
  import { diffGraphs } from "./diff.js";
7
8
  import { getDbModelsForPage, getEndpointsForPage, getPagesForDbModel } from "./query.js";
8
9
  import { readJsonFile, writeJsonFile } from "./utils.js";
@@ -37,6 +38,8 @@ export async function serve(options) {
37
38
  let isAnalyzing = false;
38
39
  let rerunRequested = false;
39
40
  let suppressGraphFileWatch = false;
41
+ let hasShownDescribeHint = false;
42
+ const describePath = path.resolve(projectRoot, path.join(path.dirname(options.graphPath ?? "arch/graph.full.json"), "describe-context.md"));
40
43
  function readExistingGraph() {
41
44
  try {
42
45
  if (fs.existsSync(graphPath)) {
@@ -73,6 +76,12 @@ export async function serve(options) {
73
76
  setTimeout(() => {
74
77
  suppressGraphFileWatch = false;
75
78
  }, 500);
79
+ // Generate describe context for AI agents
80
+ generateDescribeContext({
81
+ graphPath,
82
+ outPath: describePath,
83
+ onlyMissing: true,
84
+ });
76
85
  const pageCount = currentGraph.nodes.filter((node) => node.type === "page").length;
77
86
  const endpointCount = currentGraph.nodes.filter((node) => node.type === "endpoint").length;
78
87
  const handlerCount = currentGraph.nodes.filter((node) => node.type === "handler").length;
@@ -88,6 +97,15 @@ export async function serve(options) {
88
97
  `nodes=${currentGraph.nodes.length}`,
89
98
  `edges=${currentGraph.edges.length}`,
90
99
  ].join(" "));
100
+ if (!hasShownDescribeHint) {
101
+ hasShownDescribeHint = true;
102
+ const relGraphPath = path.relative(process.cwd(), graphPath);
103
+ const relDescribePath = path.relative(process.cwd(), describePath);
104
+ console.log("\n" +
105
+ "To add AI-generated descriptions to the graph, tell your AI agent:\n" +
106
+ "\n" +
107
+ ` Read ${relDescribePath} and follow the instructions to update ${relGraphPath}\n`);
108
+ }
91
109
  }
92
110
  catch (error) {
93
111
  console.error("Analysis error:", error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-arch-map",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "description": "Static analyzer that builds a multi-layer architecture graph for Next.js-style apps.",
5
5
  "type": "module",
6
6
  "bin": {