sourcegraph / cody

Type less, code more: Cody is an AI code assistant that uses advanced search and codebase context to help you write and fix code.
https://cody.dev
Apache License 2.0
2.27k stars 214 forks source link

PRD: [VSC] Users can configure Cody's current chat context #1675

Open taylorsperry opened 8 months ago

taylorsperry commented 8 months ago

Related Docs:

Description:

As a user, I want to be able to easily manage what Cody uses as context for a given chat prompt. I want to understand that Cody won't use any of my code as context by default, and will only use my code as context when explicitly configured.

P0: As a user, I want to easily add a single repo to Cody's current chat context. P0: As a user, I want to easily add multiple repos to Cody's current chat context. P0: As a user, I want to easily configure Cody's current chat context at a more granular level, eg, by folder, file, symbol, or line.

Objectives:

Enable users to configure Cody's current chat context across multiple levels of granularity.

Acceptance Criteria:

### Acceptance Criteria:
- [x] Users understand that Cody will use code as context, unless explicitly disabled.
- [x] Users can add a single repo to Cody's chat context
- [x] Users can add multiple repos to Cody's chat context
- [x] Users can configure context at deeper levels of granularity for a given chat (e.g., folder-, file-, symbol-level, or line(s)-level)
- [ ] #2965
- [x] By default, new chats use the same context configuration as the previous chat

Design Tasks:

### Design Tasks
- [x] Design issue -> https://github.com/sourcegraph/cody/issues/1377

Engineering Tasks:

### Engineering Tasks
- [ ] https://github.com/sourcegraph/cody/issues/1523
- [ ] https://github.com/sourcegraph/cody/issues/1525
- [ ] https://github.com/sourcegraph/cody/issues/1522
- [ ] https://github.com/sourcegraph/cody/issues/1526
- [ ] https://github.com/sourcegraph/cody/issues/1741
- [ ] https://github.com/sourcegraph/cody/issues/1524
- [ ] https://github.com/sourcegraph/cody/issues/2027
- [ ] https://github.com/sourcegraph/cody/issues/2028
- [ ] https://github.com/sourcegraph/cody/issues/2618
- [ ] https://github.com/sourcegraph/cody/issues/2622
- [ ] https://github.com/sourcegraph/cody/issues/2623
- [ ] https://github.com/sourcegraph/cody/issues/2624
- [ ] https://github.com/sourcegraph/cody/issues/2625
- [ ] https://github.com/sourcegraph/bfg-private/issues/145
- [ ] https://github.com/sourcegraph/cody/issues/2942
kalanchan commented 8 months ago

@taylorsperry I got some questions around the asks:

update: these have been addressed

kalanchan commented 7 months ago

Users understand that Cody will not use any code as context, unless explicitly configured.

FYI @taylorsperry enhanced context selector is default to ON, and users can select whether to turn it off or not

taylorsperry commented 6 months ago

Post-GA follow-ups on the existing "Acceptance Criteria" above. @toolmantim and @beyang I would love your input here.

Users can add a single repo to Cody's chat context When I have "Enhanced Context" enabled today (v1.1.1703430406) and only one project open in my workspace, I can ask Cody a question like "What does this repo do?" and Cody provides a suitable answer. However, when I have multiple projects in a workspace, I don't see a way to use @- tagging to direct Cody to one project in my workspace instead of another. This feels like something we need to enable (or make more discoverable).

Users can add multiple repos to Cody's chat context This is, of course, a feature that's in high demand. What considerations do we need to make in order to support it? Some questions I have are:

Users are notified when a folder or file is too large to be used as context. If a folder or file is too large to be used as context, does Cody still look for the most relevant snippets, or ignore the folder or file altogether?

By default, new chats use the same context configuration as the previous chat Today (afaik) this means that if the user has Enhanced Context enabled for one chat, it'll be enabled by default for a new chat. I think we should allow Free/Pro users to set a default LLM. Should Free/Pro/Enterprise users be allowed to also set default repos as context? I can see it being annoying to have to select the same, say, 3 projects over and over again, but I can also imagine someone thinking, "Why don't I just default to all the repos I ever use so I don't have to think about it" and that causing performance issues/poorer responses.

dominiccooney commented 5 months ago

@toolmantim Could you push the general question of "how do consumer users use multi-repo context?" on the design backlog?

Some related questions:

@taylorsperry it would be great to get some use case input here, I think. As a consumer, I think I would have use cases like:

toolmantim commented 5 months ago

Those are great questions… and they apply to both Enterprise and PLG.

toolmantim commented 4 months ago

@dominiccooney @taylorsperry I think you've mentioned this before, but it's only clicked that there's the important case of a user opening a repository on their computer than isn't available in their Enterprise instance.

Currently we show the following confusing UI:


I've just done up a design (Figma) with the follow repository row, representing the repository for the active file:

Custom database slash icon here (I tried the repo icon with a slash, but it was no good):

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor">
  <path d="M4,5c1,0.6,2.2,0.9,3.4,1l1-1C8.3,5,8.2,5,8,5C5.6,5,4,4,4,3.5S5.6,2,8,2c1.2,0,2.1,0.2,2.8,0.5l0.8-0.8C10.7,1.3,9.4,1,8,1 C5.2,1,3,2.1,3,3.5c0,0,0,0.1,0,0.1h0v6.8l1-1V5z"/>
  <path d="M12,12.5l0,0.1c-0.1,0.5-1.5,1.4-4,1.4c-1.1,0-1.9-0.2-2.6-0.4l-0.8,0.8C5.5,14.8,6.7,15,8,15c2.6,0,4.7-0.9,4.9-2.2 l0.1-0.4V6l-1,1V12.5z"/>
  <rect x="-1.6" y="7.3" transform="matrix(0.7071 -0.7071 0.7071 0.7071 -3.0355 8.2365)" width="20" height="1"/>
</svg>
dominiccooney commented 4 months ago

@beyang notes in Slack that we should make multi-repo selection work for multi-root workspaces in the consumer product.

fazo96 commented 3 months ago

Hi, I am evaluating Cody for my team at Flexhire and we have this folder set up:

- flexhire (git repo)
  - backend
  - frontend

We use a VSCode workspace with the following folders:

  "folders": [
    {
      "path": "backend"
    },
    {
      "path": "frontend"
    },
    {
      "path": "."
    }
  ],

I am getting this in the enhanced context popover:

image

It looks like it's getting only the first item out of the folders array. Unfortunately we need backend to be the first one because another VSCode extension we rely on has this same behavior.

We hoped we would be able to let Cody search across backend and frontend code but it doesn't seem to be the case. I have to say the product shows a lot of promise for us though

I am happy to try it again once it's able to recognize the folders correctly and index across both codebases.