Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created basic agent framework and segregated the code into different files #235

Merged
merged 81 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
d61fe67
Dart CLI Client Added
samyakkkk Feb 28, 2024
0c85f68
Merge branch 'develop' into pr/229
samyakkkk Mar 6, 2024
9cb1d05
New Task based handler implementation
samyakkkk Mar 6, 2024
4ab0756
Remove duplicate example
samyakkkk Mar 6, 2024
2c4f530
Independent Operations Support
samyakkkk Mar 10, 2024
e3de1f0
feat(Agent UI Builder): Updating json with values based on the input …
wadhia-yash Mar 12, 2024
08f6b64
feat(Agent Provider): Building agent and command logic
wadhia-yash Mar 13, 2024
9b1265f
Basic Agent Handler Method
samyakkkk Mar 14, 2024
4e40652
feat(Agent provider): Agents getting build based on the json data
wadhia-yash Mar 15, 2024
da39c55
Loader update
samyakkkk Mar 15, 2024
6ac12b6
Merge pull request #229 from Welltested-AI/cli-communication
samyakkkk Mar 15, 2024
6031f84
Install Executables from API
samyakkkk Mar 18, 2024
107678a
Setup and Secret Managers added
samyakkkk Mar 19, 2024
0ee7ebd
Merge branch 'cli-communication' into feat/setup
samyakkkk Mar 19, 2024
28cc853
(feat): SetupManager and Auth WIP
samyakkkk Mar 19, 2024
c5ba116
Merge branch 'develop' into agent-ui-builder
wadhia-yash Mar 21, 2024
73d35de
(feat): Github Signin and Refresh Token.
samyakkkk Mar 25, 2024
74eceb8
Merge branch 'develop' into feat/setup
samyakkkk Mar 25, 2024
fe00a02
(wip) activate clear up
samyakkkk Mar 25, 2024
dd976cf
(feat): Make executable chmod.
samyakkkk Mar 26, 2024
4115f04
feat(refactor): Integrated the refactor flow along with subtle UI cha…
wadhia-yash Mar 28, 2024
022c4b1
(feat): Executable manager updates
samyakkkk Mar 28, 2024
6c3b48d
(feat): Formatting updates
samyakkkk Mar 28, 2024
7de6769
Install Executable Functioning
samyakkkk Mar 29, 2024
d5a6468
Updated refactor code prompt
KevalPrajapati Mar 29, 2024
8e49c17
fix(Command Deck): Resolved the command deck issue of showing command…
wadhia-yash Apr 1, 2024
c71c8de
feat(Onboarding): New onboarding setup
wadhia-yash Apr 2, 2024
3e1c09c
(fix): not consider partial files of interrupted downloads.
samyakkkk Apr 2, 2024
69a0a3d
fix(Loading Webview): Added timeout to postmessage to webview
wadhia-yash Apr 3, 2024
62b61cf
fix(Agents, Slugs Input, Default View): Default view is not kept as c…
wadhia-yash Apr 5, 2024
ecd9a2b
(fix): Infinite executable loading
samyakkkk Apr 6, 2024
e8443e2
(feat): flutter agent with updated inputs outputs naming
samyakkkk Apr 6, 2024
fec647b
Merge branch 'develop' into agent-ui-builder
samyakkkk Apr 8, 2024
a949e6e
Fail safe error handling (#248)
samyakkkk Apr 9, 2024
a1b5a5c
feat(Questionnaire): Added questionnaire card to display on blank screen
wadhia-yash Apr 9, 2024
0fe4e70
fix(Loader): Toggling the loader based on the requirement
wadhia-yash Apr 9, 2024
8b7ffde
fix(Agents): When selecting agents and clearing the textinput without…
wadhia-yash Apr 10, 2024
6a3f832
fix(Code attachment, API key validation): Fixed code attachment UI is…
wadhia-yash Apr 11, 2024
334750d
fix(Optional, UI): Added optional field in the agents and fixed agent…
wadhia-yash Apr 12, 2024
b2e3b8d
fix: agents json updated && adds test agent
KevalPrajapati Apr 12, 2024
eb98e3f
(fix): remove timeout need for setupManager on webview boot.
samyakkkk Apr 12, 2024
3e77847
(fix): robust error handling + workspace agent functioning
samyakkkk Apr 14, 2024
e8e3619
fix(Agent Type:code_input): code_input was not attaching the value af…
wadhia-yash Apr 14, 2024
fa96840
fix(Error message, Code action): Showing api error message on onboard…
wadhia-yash Apr 16, 2024
83b887d
fix(Agents & Commands): Improved and stabalised the agents architecture
wadhia-yash Apr 16, 2024
9e69cfa
fix(Agents Menu): Added description for the agents and slugs in the menu
wadhia-yash Apr 17, 2024
63cc72d
fix(Menu Item Color): Changed the trigger detection and based on that…
wadhia-yash Apr 17, 2024
07660a1
(enhance): updated agent JSONs
samyakkkk Apr 17, 2024
a54a25d
Merge branch 'agent-ui-builder' of github.com:Welltested-AI/fluttergp…
samyakkkk Apr 17, 2024
c36135d
(fix): send agent name and version to server
samyakkkk Apr 17, 2024
55b3e0a
fix(Code action, Agent code selection): refactor command is treated a…
wadhia-yash Apr 18, 2024
73f8138
(fix): multi incoming json in single server message.
samyakkkk Apr 18, 2024
26b1fb6
fix(Code inputs): Adding the code inputs based on the selected inputs…
wadhia-yash Apr 18, 2024
d697831
(enhance): new test agent
samyakkkk Apr 18, 2024
f73dea3
fix(Code Input, Reset Data): unfocusing code input when backspace and…
wadhia-yash Apr 18, 2024
898ec20
(fix): added version to workspace agent
samyakkkk Apr 19, 2024
9505a5a
fix(Agents Dropdown): Showing intents for the commands in the dropdow…
wadhia-yash Apr 19, 2024
3d2ec81
fix(Tailwindcss)! : Removed the cdn tailwind css and moved to tailwin…
wadhia-yash Apr 19, 2024
790c056
Merge branch 'agent-ui-builder' of github.com:Welltested-AI/fluttergp…
samyakkkk Apr 19, 2024
10b74c7
fix(Loader): Hide message loader too when error occurs
wadhia-yash Apr 19, 2024
8d2ed0e
fix: Fix loader when showing error
wadhia-yash Apr 19, 2024
1c3e65a
Updated refactor prompt
KevalPrajapati Apr 19, 2024
300b133
fix: fixes executable path
KevalPrajapati Apr 19, 2024
ced076f
(fix): refresh token operation
samyakkkk Apr 19, 2024
37b55e0
Merge branch 'agent-ui-builder' of github.com:Welltested-AI/fluttergp…
samyakkkk Apr 19, 2024
37e59b2
onboarding.js: agent update
zexross Apr 19, 2024
c5cf78a
(enhance): log server error
samyakkkk Apr 20, 2024
96cdc18
(enhance): readme update to highlight agents.
samyakkkk Apr 20, 2024
7ac659c
(enhance): repo link added
samyakkkk Apr 20, 2024
9cea78c
(enhance): mention agents engine in readme
samyakkkk Apr 20, 2024
be4b3bb
(temp): disable auto-fix and optimize code actions
samyakkkk Apr 20, 2024
7b15834
(fix): mention available commands in agent prompt.
samyakkkk Apr 20, 2024
57384e0
(enhance): agent tracking telemetry
samyakkkk Apr 20, 2024
04e8a03
(fix): remove "Dash AI" instances
samyakkkk Apr 20, 2024
504c777
(fix): remove all Dash AI references in vscode commands
samyakkkk Apr 20, 2024
1c90e92
refactor prompt improvement
zexross Apr 20, 2024
18143c4
(enhance): Card UI and add more cards.
samyakkkk Apr 20, 2024
763701c
updated refactor command with generale update/modify prompt
zexross Apr 20, 2024
85e5a18
Update vscode/media/onboarding/onboarding.js
samyakkkk Apr 20, 2024
400d18e
Update vscode/media/onboarding/onboarding.js
samyakkkk Apr 20, 2024
e8fa6a1
Merge pull request #250 from CommandDash/improve/refactor-command
samyakkkk Apr 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions vscode/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,4 @@ user_config.json
#Ignore lock files

package-lock.json
yarn.lock

yarn.lock
93 changes: 27 additions & 66 deletions vscode/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
<p align="center">
<a href="" rel="noopener">
<img height=180px src="/vscode/media/icon.png"></a>
</p>
<h1 align="center">CommandDash (Beta)</h1>
<div align="center">
<h3> Your Flutter AI Autopilot with Gemini Code & Vision</h3>

Expand All @@ -11,23 +6,25 @@
<img src="/assets/docs/poster.jpg"></a>

-----------------
CommandDash is a command-based coding assistant. It has built in agents that not only help you write code, but also auto run and debug it - performing various Flutter development tasks for you.
CommandDash is a command-based coding assistant. It provides built in agents that that can automate various Flutter development tasks for you.

##### ✨ Powered by Gemini
##### 🤝 Dart Analyzer Inside
##### 👨🏼‍💻 For and by Flutter Engineers

Currently in Beta, CommandDash is being built in open-sourced with the community.
Currently in Beta, CommandDash is being built in [open-sourced](https://github.com/CommandDash/commanddash) with the community.

-----------------
## Getting Started

##### 1. Create Free Gemini API Key
##### 1. Create Gemini API Key
Visit [Makersuite by Google](https://makersuite.google.com/) and create your free API Key.

*Note: Gemini offers both free and paid plans.*
##### 2. Add the key in CommandDash Panel
Paste your API key in the input field in CommandDash Panel.
Paste your API key in the input field in Dash Panel.

That's it. You're ready to use Dash AI. ✅
That's it. You're ready to use CommandDash. ✅

## Features

Expand All @@ -36,71 +33,35 @@ That's it. You're ready to use Dash AI. ✅
<img src="/assets/docs/multi-code-attachment.gif" alt="Multi code chat with VSCode inside Gemini" width="500"/>
</p>

Attach multiple code snippets from different files in your inline chat. With full-context passed to Gemini, receive accurate responses and amend code across multiple files.
Select and attach multiple code snippets from different files in your inline chat using **"Attach Snippet to Dash"** from the right-click menu.

🤝 With full-context passed to Gemini, receive accurate responses and update code across multiple files.

### 🚀 @Agents and /Commands

Use built in agents and commands to autopilot different kinds of tasks.

Currently, we support:

#### 1. `@workspace` agent.
Ask anything related to Flutter or Dart and get instant answers. Query your workspace using `@workspace` command.

#### 2. `/refactor` command.
<p align="center">
<img src="/assets/docs/refactor-command.png" alt="Multi code chat with VSCode inside Gemini" width="500"/>
</p>

More, coming very soon.
Currently, we offer following agents and commands:

### ✨ Generate Inline Code
#### 1. `@workspace`
Directly query across your workspace and find relevant files related to a feature. Leverage this command to build an understand of the codebase you are working with.

#### 1. **Code Block Completion**
#### 2. `@test`
Generate unit, widget and integration tests with full-context for your Flutter/Dart project.

Complete methods, classes or any other code blocks by running `Inline Code Generation` from the menu or via `cmd+shift+R`.
✅ Also, attach previously existing tests as references to help Gemini learn your testing style and choice of libraries.

Specify details with comments for better accuracy. For example,
#### 3. `@flutter`
✨ Use `/doc` command answer your Flutter/Dart questions from trusted sources including official docs.

```dart
class Cart {
// Properties
List<Item> items = [];
#### 4. `/refactor` and `/document`

void addItem(Item item) {
items.add(item);
}
Modify your existing code with instructions and apply the changes.

void removeItem(Item item) {
items.remove(item);
}
// get total price method
**[cmd+shift+R]**
}
```

completes the next lines with:
``` dart
double getTotalPrice() {
double total = 0;
for (Item item in items) {
total += item.price;
}
return total;
}
```

#### 2. **Widget from Image or Description**

Use Gemini's multimodal capabilities to create widget from a image with added description.

Command: `Dash AI Create: Widget from Image or Description`

#### 3. **Code from Blueprint**

Get complete code from a blueprint of a class or function with the behaviour of functions, state management and architecture of your choice.
<p align="center">
<img src="/assets/docs/refactor-command.png" alt="Refactoring code with CommandDash" width="500"/>
</p>

Command: `Dash AI Create: Code from Blueprint`

## FAQs

Expand All @@ -109,14 +70,14 @@ Command: `Dash AI Create: Code from Blueprint`

2. **Do I need to pay to use CommandDash?**

- Gemini PRO is currently in early access and is completely free to use for upto 60 requests for minute. Please check the [pricing](https://ai.google.dev/pricing) here.
- Gemini PRO offers both free and paid plans. Please check the [pricing](https://ai.google.dev/pricing) here.

3. **I am an Android Studio user. Can I use Dash AI?**
3. **I am an Android Studio user. Can I use CommandDash?**
- We are coming soon for IntelliJ-based IDEs. *🤫 Secret: most of our core logic is written in Dart, allowing us to ship on any platform very very fast!*

## Contributing

A coding assistant for all is best built when all of us contribute. You can make contributions to the VSCODE or IntelliJ extension or also to [CommandDash CLI](https://github.com/Welltested-AI/commanddash) shared between the extensions.
A coding assistant for all is best built when all of us contribute. You can make contributions to the VSCODE or IntelliJ extension or also to [agents engine](https://github.com/CommandDash/packages) shared between the extensions.

### Ways to contribute

Expand All @@ -134,4 +95,4 @@ Connect with like minded people building with Flutter and using AI to do so, eve

## License

Dash AI is released under the Apache License Version 2.0. See the [LICENSE](LICENSE) file for more information.
CommandDash is released under the Apache License Version 2.0. See the [LICENSE](LICENSE) file for more information.
15 changes: 15 additions & 0 deletions vscode/media/agent-provider/agent-provider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class AgentProvider {
constructor(json) {
this.json = json;
}
getInputs(inputString) {
for (const item of this.json) {
for (const command of item.supported_commands) {
if (command.slug === inputString) {
return JSON.parse(JSON.stringify(command));
}
}
}
return [];
}
}
118 changes: 118 additions & 0 deletions vscode/media/agent-ui-builder/agent-ui-builder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
class AgentUIBuilder {
constructor(ref) {
this.ref = ref;

this.onStringInput = this.onStringInput.bind(this);
this.buildAgentUI = this.buildAgentUI.bind(this);

this.container = document.createElement("div");

this.codeInputIds = [];
}

buildAgentUI() {
const { text_field_layout, registered_inputs, slug } = agentInputsJson[0];
let textHtml = text_field_layout;
registered_inputs.forEach(input => {
const inputElement = this.createInputElement(input);
this.container.appendChild(inputElement);
textHtml = textHtml.replace(`<${input.id}>`, inputElement.outerHTML);
});

this.container.innerHTML = `<span class="inline-block text-pink-500" contenteditable="false">${slug}&nbsp;</span>${textHtml}`;
this.ref.appendChild(this.container);
this.registerCodeInputListener();
}

createInputElement(input) {
const { id, display_text, type, optional } = input;
const _optional = optional ? "(O)" : "";
if (type === "string_input") {
const inputContainer = document.createElement("span");
const inputSpan = document.createElement("span");
inputContainer.innerHTML = `<span contenteditable="false" class="bg-black text-white px-[7px] border border-black rounded-tl-[4px] rounded-bl-[4px] inline-block">${_optional} ${display_text}</span>`;
inputContainer.classList.add("inline-block");

inputSpan.id = id;
inputSpan.contentEditable = true;
inputSpan.tabIndex = 0;
inputSpan.classList.add("px-2", "inline-block", "rounded-tr-[4px]", "rounded-br-[4px]", "string_input", id, "mb-1", "ml-[1px]", "mr-[1px]");
inputSpan.textContent = '\u200B';

this.ref.addEventListener('input', (event) => this.onStringInput(event, id));
this.ref.addEventListener('paste', () => this.onTextPaste(id));

inputContainer.appendChild(inputSpan);

requestAnimationFrame(() => {
if (!optional) {
const input = document.getElementById(id);
const selection = window.getSelection();
const range = document.createRange();
range.selectNodeContents(input);
range.collapse(false);
selection.removeAllRanges();
selection.addRange(range);
}
});

return inputContainer;
}

if (type === "code_input") {
const codeContainer = document.createElement("span");
const codePlaceholder = document.createElement("span");

codeContainer.classList.add("code-input-container");

codePlaceholder.id = id;
codePlaceholder.contentEditable = "false";
codePlaceholder.tabIndex = 0;
codePlaceholder.classList.add("ml-1", "mb-1", "px-[7px]", "inline-flex", "cursor-pointer", "rounded-[4px]", "mt-1", "code_input", "items-center");
codePlaceholder.textContent = `${_optional} ${display_text}`;
codeContainer.id = "code-container";
codeContainer.appendChild(codePlaceholder);
this.codeInputIds.push(id);

// this.ref.addEventListener("click", this.onCodeInputClick);

return codeContainer;
}
}

registerCodeInputListener() {
this.codeInputIds.forEach((_codeInputId) => {
const codeInput = document.getElementById(_codeInputId);
codeInput.addEventListener("focus", () => {
codeInputId = _codeInputId;
});
});
}

onTextPaste(id) {
const inputSpan = document.getElementById(id);
inputSpan.dispatchEvent(new Event('input', { bubbles: true }));
}

onStringInput(event, id) {
const sel = window.getSelection();
const inputSpan = document.getElementById(id);
if (event.target === inputSpan || (sel.anchorNode && sel.anchorNode.parentNode && sel.anchorNode.parentNode.classList.contains(id))) {
const inputIndex = agentInputsJson[0].registered_inputs.findIndex(_input => _input.id === id);
if (inputIndex !== -1) {
agentInputsJson[0].registered_inputs[inputIndex].value = inputSpan.textContent.trim();
}
}
}

onCodeInput(chipsData, chipName) {
const firstCodeInput = agentInputsJson[0].registered_inputs.find(input => input.type === "code_input" && ( codeInputId === 0 ? input.value === undefined : input.id === codeInputId));

if (firstCodeInput) {
const codeInputSpan = document.getElementById(firstCodeInput.id);
firstCodeInput.value = JSON.stringify(chipsData);
codeInputSpan.innerHTML = `<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">${dartIcon}</svg><span class="ml-1" id="${firstCodeInput.id}">${chipName}</span>`;
codeInputId = 0;
}
}
}
Loading
Loading