Skip to content

Commit

Permalink
Merge pull request #61 from RussellCanfield/feature/CodeReview
Browse files Browse the repository at this point in the history
Feature/code review
  • Loading branch information
RussellCanfield authored Nov 5, 2024
2 parents d199e22 + c5f930c commit cae2d88
Show file tree
Hide file tree
Showing 49 changed files with 3,424 additions and 338 deletions.
9 changes: 9 additions & 0 deletions docs-site/docs/guide/chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,12 @@ With the new **Indexing** feature, Wingman will automatically find relevant code
[![Wingman AI chat example](https://img.youtube.com/vi/1W3h2mOdjmc/0.jpg)](https://www.youtube.com/watch?v=1W3h2mOdjmc)

[![Wingman AI chat example](https://img.youtube.com/vi/2sJZpyYi3Fc/0.jpg)](https://www.youtube.com/watch?v=2sJZpyYi3Fc)

## Commands

Wingman now features commands in chat! This is the first step towards condensing experiences and interaction points for the user. While not all interactions fit well under chat, we plan to add additional commands in the near future.
To get started with commands **type "/" in chat**.

We currently support the following commands:

- review, this will generate a summary of your local changes and allow you to perform file-by-file reviews.
2 changes: 1 addition & 1 deletion docs-site/docs/guide/compose.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Composer supports uploading images either through the **attachment icon or copy
Composer will iterate over 3 unique phases for code generation:

:::note
Wingman will automatically choose "gpt-4o-mini" or "claude haiku 3" for reranking results during planning. Ollama does not have a safe default and will use the existing chat model.
Wingman will automatically choose "gpt-4o-mini" or "claude haiku 3.5" for reranking results during planning. Ollama does not have a safe default and will use the existing chat model.
:::

- **Planning**
Expand Down
2 changes: 1 addition & 1 deletion docs-site/docs/guide/indexing.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Files will not be re-indexed on save if their contents have not changed.
:::

:::note
Wingman will use cheaper models for indexing code files, for **Anthropic** it will use Claude-3-Haiku, and for **OpenAI** it will use gpt-4o-mini
Wingman will use cheaper models for indexing code files, for **Anthropic** it will use Claude-3.5-Haiku, and for **OpenAI** it will use gpt-4o-mini
:::

Wingman is the only code assistant that not only embeds files, but creates a comprehensive graph of your entire codebase. Allowing Wingman to leverage file to file relationships.
Expand Down
133 changes: 67 additions & 66 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
"docs": "cd docs-site && npm run dev"
},
"dependencies": {
"@ast-grep/napi": "0.28.1",
"@ast-grep/napi": "0.29.0",
"@langchain/anthropic": "0.3.5",
"@langchain/community": "0.3.6",
"@langchain/core": "0.3.13",
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const downloadAndExtract = async (pkg, outDir) => {
const { default: fetch } = await import("node-fetch");
const url = `https://registry.npmjs.org/${pkg}/-/${pkg
.split("/")
.pop()}-0.28.1.tgz`;
.pop()}-0.29.0.tgz`;
console.log(`Downloading ${pkg} from ${url}`);
const response = await fetch(url);
if (!response.ok) {
Expand Down
2 changes: 1 addition & 1 deletion shared/src/types/Composer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FileMetadata } from "./Message";
export type DiffViewCommand = {
file: string;
diff: string;
theme?: Number;
isDarkTheme?: boolean;
original?: string;
};

Expand Down
54 changes: 52 additions & 2 deletions shared/src/types/Message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,61 @@ export interface AppMessage {
value: unknown;
}

export interface ChatMessage {
export interface FileReviewDetails {
file: string;
diff?: string;
original?: string;
current?: string;
comments?: CodeReviewComment[];
}

export interface FileDetails {
diff: string;
file: string;
}

export type CodeCommentAction = undefined | "remove" | "replace";

export interface CodeReviewComment {
startLine: number;
endLine?: number;
action?: CodeCommentAction;
body: string;
code?: string;
accepted?: boolean;
rejected?: boolean;
}

export interface CodeReview {
summary: string;
fileDiffMap?: Record<string, FileReviewDetails>;
}

export interface CodeReviewCommand {
review: CodeReview;
isDarkTheme: boolean;
}

export type MessageType = "chat" | "code-review";

export type ChatMessages = Message[] | CodeReviewMessage[];
export type ChatMessage = Message | CodeReviewMessage;

export interface CodeReviewMessage extends BaseMessage {
review: CodeReview;
type: "code-review";
}

export interface Message extends BaseMessage {
context?: CodeContext;
from: "assistant" | "user";
message: string;
type: "chat";
}

export interface BaseMessage {
loading?: boolean;
context?: CodeContext;
type?: MessageType;
}

export interface FileMetadata {
Expand Down
Loading

0 comments on commit cae2d88

Please sign in to comment.