getappmap / appmap-js

Client libraries for AppMap
49 stars 17 forks source link

If a user mentions a file by name, try to send the whole text with the context (if feasible) #1775

Open dividedmind opened 7 months ago

dividedmind commented 7 months ago

Sometimes a user has a specific file in mind with the query that they want to edit or analyze. For example, I tried this query:

@generate Recently a user had a problem running appmap-node: they had a script in package.json that read "npm run generate-types & npm run server"; they edited it, inteding to run the server with appmap-node, to "appmap-node npm run generate-types & npm run server". However, this had the effect of only running the generate-types script instrumented, with requests to the server consequently not getting recorded. Propose changes to the appmap-node.md file that will help users avoid this mistake.

It turns out that in the context, Navie only got bits and pieces of the file in question. The answer wasn't bad, but I can't help but feel it could have been much better if it could see the whole thing. Obviously this won't always be feasible: it might not fit in the context window. However when the user explicitly calls out a file, I feel it should be prioritized to transfer that.

kgilpin commented 7 months ago

Another option might be a directive like a slash command to compel Naive to do this, something like /file=appmap-node.md (which would search for the named file across the available directories).

kgilpin commented 7 months ago

Slash-command parsing is in this WIP commit - https://github.com/getappmap/appmap-js/pull/1770/commits/bc4c197463b725fba5d544ffee851d18a1d7a163

kgilpin commented 4 months ago

@dustinbyrne this can be related to https://github.com/getappmap/appmap-js/issues/1895 - in which the RPC service can provide the full text of a file