Skip to content

Commit f4f8cb9

Browse files
committed
Merge branch 'main' into mcp-enablement-squashed
2 parents 3c5fbf7 + 9c8de3a commit f4f8cb9

File tree

11 files changed

+92
-19
lines changed

11 files changed

+92
-19
lines changed

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,26 @@ pnpm install --ignore-scripts
156156
### 3. Start Local Development
157157
To compile and view changes made to `q chat`:
158158
```shell
159-
alias run_q_chat='cargo run --bin q_cli -- chat'
160-
run_q_chat
159+
cargo run --bin q_cli -- chat
161160
```
162161

163162
> If you are working on other q commands, just replace `chat` with the command name
164163
164+
To run tests for the Q CLI crate:
165+
```shell
166+
cargo test -p q_cli
167+
```
168+
169+
To format Rust files:
170+
```shell
171+
cargo +nightly fmt
172+
```
173+
174+
To run clippy:
175+
```shell
176+
cargo clippy --locked --workspace --color always -- -D warnings
177+
```
178+
165179

166180

167181
### 💡 Quick Tip for Onboarding
@@ -198,7 +212,7 @@ Great for speeding up your ramp-up and navigating the repo more effectively.
198212
Several projects live here:
199213

200214
- [`autocomplete`](packages/autocomplete/) - The autocomplete react app
201-
- [`dashboard`](packages/dashboard/) - The dashboard react app
215+
- [`dashboard`](packages/dashboard-app/) - The dashboard react app
202216
- [`figterm`](crates/figterm/) - figterm, our headless terminal/pseudoterminal that
203217
intercepts the user’s terminal edit buffer.
204218
- [`q_cli`](crates/q_cli/) - the `q` CLI, allows users to interface with Amazon Q Developer from

crates/fig_desktop/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ instructions in the [root README](../README.md).
66

77
## Developing
88

9-
1. Follow the instructions under [the dashboard README](../packages/dashboard/README.md) to run the development server.
9+
1. Follow the instructions under [the dashboard README](../packages/dashboard-app/README.md) to run the development server.
1010
1. Run `cargo run`.
1111
1. Once the UI opens, right click anywhere to inspect element, go to the console tab, and set `window.location.href`
1212
to the URL of the dashboard development server.

crates/q_cli/src/cli/chat/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,6 +1441,8 @@ where
14411441
context_manager: self.conversation_state.context_manager.clone(),
14421442
transcript: self.conversation_state.transcript.clone(),
14431443
failed_request_ids: self.failed_request_ids.clone(),
1444+
accept_all: self.accept_all,
1445+
interactive: self.interactive,
14441446
});
14451447
},
14461448
_ => (),

crates/q_cli/src/cli/chat/parse.rs

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,30 @@ fn url<'a, 'b>(
404404
state: &'b mut ParseState,
405405
) -> impl FnMut(&mut Partial<&'a str>) -> PResult<(), Error<'a>> + 'b {
406406
move |i| {
407-
let display = delimited("[", take_until(1.., "]("), "]").parse_next(i)?;
408-
let link = delimited("(", take_till(0.., ')'), ")").parse_next(i)?;
407+
// Save the current input position
408+
let start = i.checkpoint();
409+
410+
// Try to match the first part of URL pattern "[text]"
411+
let display = match delimited::<_, _, _, _, Error<'a>, _, _, _>("[", take_until(1.., "]("), "]").parse_next(i) {
412+
Ok(display) => display,
413+
Err(_) => {
414+
// If it doesn't match, reset position and fail
415+
i.reset(&start);
416+
return Err(ErrMode::from_error_kind(i, ErrorKind::Fail));
417+
},
418+
};
419+
420+
// Try to match the second part of URL pattern "(url)"
421+
let link = match delimited::<_, _, _, _, Error<'a>, _, _, _>("(", take_till(0.., ')'), ")").parse_next(i) {
422+
Ok(link) => link,
423+
Err(_) => {
424+
// If it doesn't match, reset position and fail
425+
i.reset(&start);
426+
return Err(ErrMode::from_error_kind(i, ErrorKind::Fail));
427+
},
428+
};
409429

430+
// Only generate output if the complete URL pattern matches
410431
queue_newline_or_advance(&mut o, state, display.width() + 1)?;
411432
queue(&mut o, style::SetForegroundColor(URL_TEXT_COLOR))?;
412433
queue(&mut o, style::Print(format!("{display} ")))?;
@@ -726,4 +747,16 @@ mod tests {
726747
style::SetForegroundColor(BLOCKQUOTE_COLOR),
727748
style::Print("│ hello"),
728749
]);
750+
validate!(square_bracket_1, "[test]", [style::Print("[test]")]);
751+
validate!(square_bracket_2, "Text with [brackets]", [style::Print(
752+
"Text with [brackets]"
753+
)]);
754+
validate!(square_bracket_empty, "[]", [style::Print("[]")]);
755+
validate!(square_bracket_array, "a[i]", [style::Print("a[i]")]);
756+
validate!(square_bracket_url_like_1, "[text] without url part", [style::Print(
757+
"[text] without url part"
758+
)]);
759+
validate!(square_bracket_url_like_2, "[text](without url part", [style::Print(
760+
"[text](without url part"
761+
)]);
729762
}

crates/q_cli/src/cli/chat/tools/gh_issue.rs

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ pub struct GhIssueContext {
3434
pub context_manager: Option<ContextManager>,
3535
pub transcript: VecDeque<String>,
3636
pub failed_request_ids: Vec<String>,
37+
pub accept_all: bool,
38+
pub interactive: bool,
3739
}
3840

3941
/// Max amount of user chat + assistant recent chat messages to include in the issue.
@@ -48,7 +50,12 @@ impl GhIssue {
4850
};
4951

5052
// Prepare additional details from the chat session
51-
let additional_environment = [Self::get_request_ids(context), Self::get_context(context).await].join("\n\n");
53+
let additional_environment = [
54+
Self::get_chat_settings(context),
55+
Self::get_request_ids(context),
56+
Self::get_context(context).await,
57+
]
58+
.join("\n\n");
5259

5360
// Add chat history to the actual behavior text.
5461
let actual_behavior = self.actual_behavior.as_ref().map_or_else(
@@ -124,20 +131,29 @@ impl GhIssue {
124131
return ctx_str;
125132
};
126133

127-
ctx_str.push_str(&format!("current_profile={}\n\n", ctx_manager.current_profile));
134+
ctx_str.push_str(&format!("current_profile={}\n", ctx_manager.current_profile));
135+
match ctx_manager.list_profiles().await {
136+
Ok(profiles) if !profiles.is_empty() => {
137+
ctx_str.push_str(&format!("profiles=\n{}\n\n", profiles.join("\n")));
138+
},
139+
_ => ctx_str.push_str("profiles=none\n\n"),
140+
}
128141

129142
// Context file categories
130143
if ctx_manager.global_config.paths.is_empty() {
131-
ctx_str.push_str("global=none\n\n");
144+
ctx_str.push_str("global_context=none\n\n");
132145
} else {
133-
ctx_str.push_str(&format!("global=\n{}\n\n", &ctx_manager.global_config.paths.join("\n")));
146+
ctx_str.push_str(&format!(
147+
"global_context=\n{}\n\n",
148+
&ctx_manager.global_config.paths.join("\n")
149+
));
134150
}
135151

136152
if ctx_manager.profile_config.paths.is_empty() {
137-
ctx_str.push_str("profile=none\n\n");
153+
ctx_str.push_str("profile_context=none\n\n");
138154
} else {
139155
ctx_str.push_str(&format!(
140-
"profile=\n{}\n\n",
156+
"profile_context=\n{}\n\n",
141157
&ctx_manager.profile_config.paths.join("\n")
142158
));
143159
}
@@ -162,6 +178,14 @@ impl GhIssue {
162178
ctx_str
163179
}
164180

181+
fn get_chat_settings(context: &GhIssueContext) -> String {
182+
let mut result_str = "[chat-settings]\n".to_string();
183+
result_str.push_str(&format!("accept_all={}\n", context.accept_all));
184+
result_str.push_str(&format!("interactive={}", context.interactive));
185+
186+
result_str
187+
}
188+
165189
pub fn queue_description(&self, updates: &mut impl Write) -> Result<()> {
166190
Ok(queue!(
167191
updates,

crates/q_cli/src/cli/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ impl Cli {
348348
CliRootCommands::Inline(subcommand) => subcommand.execute(&cli_context).await,
349349
},
350350
// Root command
351-
None => launch_dashboard(true).await,
351+
None => chat::chat(None, false, false, None).await,
352352
}
353353
}
354354

docs/assets/architecture.mermaid

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ flowchart LR
1414
autocomplete[fa:fa-window-restore Autocomplete *]
1515
click autocomplete href "packages/autocomplete"
1616
dashboard[fa:fa-window-maximize Dashboard *]
17-
click dashboard href "packages/dashboard"
17+
click dashboard href "packages/dashboard-app"
1818
end
1919
localCli[Q CLI *]
2020
click localCli href "q_cli"

docs/assets/architecture.svg

Lines changed: 1 addition & 1 deletion
Loading

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
"lint:fix": "turbo lint:fix --parallel",
2121
"dev": "turbo dev",
2222
"dev:autocomplete": "pnpm -C packages/autocomplete dev",
23-
"dev:dashboard": "pnpm -C packages/dashboard dev",
23+
"dev:dashboard": "pnpm -C packages/dashboard-app dev",
2424
"preview:autocomplete": "pnpm -C packages/autocomplete preview",
25-
"preview:dashboard": "pnpm -C packages/dashboard preview",
25+
"preview:dashboard": "pnpm -C packages/dashboard-app preview",
2626
"clean": "turbo clean --parallel",
2727
"prepare": "husky",
2828
"precommit": "lint-staged --config .lintstagedrc.mjs",

packages/dashboard-app/src/components/preference/listItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export function Setting({
122122
<SelectTrigger className="w-60">
123123
<SelectValue />
124124
</SelectTrigger>
125-
<SelectContent>
125+
<SelectContent className="max-h-64 overflow-auto">
126126
<SelectGroup>
127127
{data.options?.map((o, i) => {
128128
// console.log({ pref: data.id, localValue, inputValue: o, equal: localValue === o })

0 commit comments

Comments
 (0)