Skip to content

Commit df3940e

Browse files
committed
feat: Add standalone CLI
remove chat from q_cli give temporary name rename chat-cli crate checkpoint finish fixing lints support windows fix more osx lints fix: compile q and qchat on Linux bundle qchat with the desktop app fix: more broken lints on linux, remove unused code add q issue add chat execute add copying chat binary in appimage install port thinking tool port execute_bash summary from main fix build partial #1403 sdjifodjio run fmt
1 parent a7d09a7 commit df3940e

File tree

199 files changed

+16023
-1426
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

199 files changed

+16023
-1426
lines changed

Cargo.lock

Lines changed: 933 additions & 612 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ objc2-input-method-kit = "0.2.2"
106106
parking_lot = "0.12.3"
107107
percent-encoding = "2.2.0"
108108
portable-pty = "0.8.1"
109-
q_chat = { path = "crates/q_chat" }
110109
r2d2 = "0.8.10"
111110
r2d2_sqlite = "0.25.0"
112111
rand = "0.9.0"

build-scripts/build.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
from importlib import import_module
3434
from const import (
3535
APP_NAME,
36+
CHAT_BINARY_NAME,
37+
CHAT_PACKAGE_NAME,
3638
CLI_BINARY_NAME,
3739
CLI_PACKAGE_NAME,
3840
DESKTOP_BINARY_NAME,
@@ -208,12 +210,13 @@ def build_macos_ime(
208210
return input_method_app
209211

210212

211-
def macos_tauri_config(cli_path: pathlib.Path, pty_path: pathlib.Path, target: str) -> str:
213+
def macos_tauri_config(cli_path: pathlib.Path, chat_path: pathlib.Path, pty_path: pathlib.Path, target: str) -> str:
212214
config = {
213215
"tauri": {
214216
"bundle": {
215217
"externalBin": [
216218
str(cli_path).removesuffix(f"-{target}"),
219+
str(chat_path).removesuffix(f"-{target}"),
217220
str(pty_path).removesuffix(f"-{target}"),
218221
],
219222
"resources": ["manifest.json"],
@@ -227,6 +230,7 @@ def build_macos_desktop_app(
227230
release: bool,
228231
pty_path: pathlib.Path,
229232
cli_path: pathlib.Path,
233+
chat_path: pathlib.Path,
230234
npm_packages: NpmBuildOutput,
231235
is_prod: bool,
232236
signing_data: CdSigningData | None,
@@ -244,7 +248,7 @@ def build_macos_desktop_app(
244248

245249
info("Building tauri config")
246250
tauri_config_path = pathlib.Path(DESKTOP_PACKAGE_PATH) / "build-config.json"
247-
tauri_config_path.write_text(macos_tauri_config(cli_path=cli_path, pty_path=pty_path, target=target))
251+
tauri_config_path.write_text(macos_tauri_config(cli_path=cli_path, chat_path=chat_path, pty_path=pty_path, target=target))
248252

249253
info("Building", DESKTOP_PACKAGE_NAME)
250254

@@ -467,6 +471,7 @@ def build_linux_minimal(cli_path: pathlib.Path, pty_path: pathlib.Path):
467471
def linux_tauri_config(
468472
cli_path: pathlib.Path,
469473
pty_path: pathlib.Path,
474+
chat_path: pathlib.Path,
470475
dashboard_path: pathlib.Path,
471476
autocomplete_path: pathlib.Path,
472477
vscode_path: pathlib.Path,
@@ -483,6 +488,7 @@ def linux_tauri_config(
483488
"externalBin": [
484489
str(cli_path).removesuffix(f"-{target}"),
485490
str(pty_path).removesuffix(f"-{target}"),
491+
str(chat_path).removesuffix(f"-{target}"),
486492
],
487493
"targets": ["appimage"],
488494
"icon": ["icons/128x128.png"],
@@ -535,6 +541,7 @@ def make_linux_bundle_metadata(packaged_as: Package) -> pathlib.Path:
535541
class LinuxDebResources:
536542
cli_path: pathlib.Path
537543
pty_path: pathlib.Path
544+
chat_path: pathlib.Path
538545
desktop_path: pathlib.Path
539546
themes_path: pathlib.Path
540547
legacy_extension_dir_path: pathlib.Path
@@ -573,6 +580,7 @@ def build_linux_deb(
573580
bin_path.mkdir(parents=True)
574581
shutil.copy(resources.cli_path, bin_path / CLI_BINARY_NAME)
575582
shutil.copy(resources.pty_path, bin_path / PTY_BINARY_NAME)
583+
shutil.copy(resources.chat_path, bin_path / CHAT_BINARY_NAME)
576584
shutil.copy(resources.desktop_path, bin_path / DESKTOP_BINARY_NAME)
577585

578586
info("Copying /usr/share resources")
@@ -629,6 +637,7 @@ def build_linux_full(
629637
release: bool,
630638
cli_path: pathlib.Path,
631639
pty_path: pathlib.Path,
640+
chat_path: pathlib.Path,
632641
npm_packages: NpmBuildOutput,
633642
features: Mapping[str, Sequence[str]] | None = None,
634643
):
@@ -668,6 +677,7 @@ def copy_extension(extension_uuid, extension_dir_name):
668677
linux_tauri_config(
669678
cli_path=cli_path,
670679
pty_path=pty_path,
680+
chat_path=chat_path,
671681
dashboard_path=npm_packages.dashboard_path,
672682
autocomplete_path=npm_packages.autocomplete_path,
673683
vscode_path=npm_packages.vscode_path,
@@ -703,6 +713,7 @@ def copy_extension(extension_uuid, extension_dir_name):
703713
deb_resources = LinuxDebResources(
704714
cli_path=cli_path,
705715
pty_path=pty_path,
716+
chat_path=chat_path,
706717
desktop_path=desktop_path,
707718
themes_path=themes_path,
708719
legacy_extension_dir_path=legacy_extension_dir_path,
@@ -846,6 +857,16 @@ def build(
846857
targets=targets,
847858
)
848859

860+
info("Building", CHAT_PACKAGE_NAME)
861+
chat_path = build_cargo_bin(
862+
variant=variant,
863+
release=release,
864+
package=CHAT_PACKAGE_NAME,
865+
output_name=CHAT_BINARY_NAME,
866+
features=cargo_features,
867+
targets=targets,
868+
)
869+
849870
info("Building", PTY_PACKAGE_NAME)
850871
pty_path = build_cargo_bin(
851872
variant=variant,
@@ -864,6 +885,7 @@ def build(
864885
build_paths = build_macos_desktop_app(
865886
release=release,
866887
cli_path=cli_path,
888+
chat_path=chat_path,
867889
pty_path=pty_path,
868890
npm_packages=npm_packages,
869891
signing_data=signing_data,
@@ -889,6 +911,7 @@ def build(
889911
release=release,
890912
cli_path=cli_path,
891913
pty_path=pty_path,
914+
chat_path=chat_path,
892915
npm_packages=npm_packages,
893916
features=cargo_features,
894917
)

build-scripts/const.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
APP_NAME = "Amazon Q"
55
CLI_BINARY_NAME = "q"
6+
CHAT_BINARY_NAME = "qchat"
67
PTY_BINARY_NAME = "qterm"
78
DESKTOP_BINARY_NAME = "q-desktop"
89
URL_SCHEMA = "q"
@@ -20,6 +21,7 @@
2021

2122
# cargo packages
2223
CLI_PACKAGE_NAME = "q_cli"
24+
CHAT_PACKAGE_NAME = "chat_cli"
2325
PTY_PACKAGE_NAME = "figterm"
2426
DESKTOP_PACKAGE_NAME = "fig_desktop"
2527
DESKTOP_FUZZ_PACKAGE_NAME = "fig_desktop-fuzz"

bundle/linux/install.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ fi
137137

138138
if [ -n "${Q_INSTALL_GLOBAL:-}" ]; then
139139
install -m 755 "$SCRIPT_DIR/bin/q" /usr/local/bin/
140+
install -m 755 "$SCRIPT_DIR/bin/qchat" /usr/local/bin/
140141
install -m 755 "$SCRIPT_DIR/bin/qterm" /usr/local/bin/
141142

142143
/usr/local/bin/q integrations install dotfiles
@@ -145,6 +146,7 @@ else
145146
mkdir -p "$HOME/.local/bin"
146147

147148
install -m 755 "$SCRIPT_DIR/bin/q" "$HOME/.local/bin/"
149+
install -m 755 "$SCRIPT_DIR/bin/qchat" "$HOME/.local/bin/"
148150
install -m 755 "$SCRIPT_DIR/bin/qterm" "$HOME/.local/bin/"
149151

150152
"$HOME/.local/bin/q" setup "$@"

crates/amzn-toolkit-telemetry/Cargo.toml renamed to crates/amzn-toolkit-telemetry-client/Cargo.toml

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,10 @@
1111

1212
[package]
1313
edition = "2021"
14-
name = "amzn-toolkit-telemetry"
14+
name = "amzn-toolkit-telemetry-client"
1515
version = "1.0.0"
1616
authors = ["Grant Gurvis <grangurv@amazon.com>"]
17-
exclude = [
18-
"/build",
19-
"/Config",
20-
"/build-tools/",
21-
]
17+
exclude = ["/build", "/Config", "/build-tools/"]
2218
publish = ["brazil"]
2319
description = "Rust client bindings for the toolkit-telemetry service"
2420

@@ -53,10 +49,7 @@ features = ["client"]
5349

5450
[dependencies.aws-smithy-runtime-api]
5551
version = "1.1.3"
56-
features = [
57-
"client",
58-
"http-02x",
59-
]
52+
features = ["client", "http-02x"]
6053

6154
[dependencies.aws-smithy-types]
6255
version = "1.1.3"
@@ -79,16 +72,7 @@ features = ["test-util"]
7972

8073
[features]
8174
behavior-version-latest = []
82-
default = [
83-
"rustls",
84-
"rt-tokio",
85-
]
86-
rt-tokio = [
87-
"aws-smithy-async/rt-tokio",
88-
"aws-smithy-types/rt-tokio",
89-
]
75+
default = ["rustls", "rt-tokio"]
76+
rt-tokio = ["aws-smithy-async/rt-tokio", "aws-smithy-types/rt-tokio"]
9077
rustls = ["aws-smithy-runtime/tls-rustls"]
91-
test-util = [
92-
"aws-credential-types/test-util",
93-
"aws-smithy-runtime/test-util",
94-
]
78+
test-util = ["aws-credential-types/test-util", "aws-smithy-runtime/test-util"]

crates/amzn-toolkit-telemetry/src/client.rs renamed to crates/amzn-toolkit-telemetry-client/src/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ impl Client {
100100
/// operation call. For example, this can be used to add an additional HTTP header:
101101
///
102102
/// ```ignore
103-
/// # async fn wrapper() -> ::std::result::Result<(), amzn_toolkit_telemetry::Error> {
104-
/// # let client: amzn_toolkit_telemetry::Client = unimplemented!();
103+
/// # async fn wrapper() -> ::std::result::Result<(), amzn_toolkit_telemetry_client::Error> {
104+
/// # let client: amzn_toolkit_telemetry_client::Client = unimplemented!();
105105
/// use ::http::header::{HeaderName, HeaderValue};
106106
///
107107
/// let result = client.post_error_report()

0 commit comments

Comments
 (0)