Skip to content

Commit 22281fd

Browse files
Fixed (#5)
* feat: Unify CLI with custom UI and update authors This commit completes the transition to a new, custom user interface across the entire SuperQwen CLI, ensuring a consistent look and feel for all commands. It also updates the project's author information as requested. - Created a new UI module at `SuperQwen/setup/ui.py` with components for menus, progress bars, and styled console output. - Refactored `SuperQwen/setup/cli.py` and `SuperQwen/setup/interactive.py` to replace all `rich` and `questionary` calls with the new `ui.py` module. - Updated `SuperQwen/__init__.py` with the correct author and email information for NomenAK and Mithun Gowda B. - Removed the now-unused `rich` and `questionary` dependencies from `pyproject.toml`, streamlining the project's dependencies. - All interactive and non-interactive commands now share the same custom UI for a cohesive user experience. * docs: Overhaul README with advanced structure and content This commit completely revamps the `README.md` file to provide a more professional, comprehensive, and user-friendly overview of the SuperQwen Framework. - Restructured the README for better logical flow and readability. - Added a "Key Features" section with highlights of the project's capabilities. - Updated the "Installation" and "Usage" sections with clearer instructions and more detailed examples. - Included a preview of the new, custom installer UI to give users a glimpse of the experience. - Added a table of all available `/sq` commands for quick reference. - Added a "Configuration" section to explain how MCP servers are handled. - Improved markdown formatting for better visual presentation. * docs: Clarify command usage in README This commit updates the `README.md` to clarify how `/sq` commands are used, based on an investigation of the command structure. - Investigated the `.toml` files in `SuperQwen/Commands/` and determined that the `/sq` commands do not accept any flags or arguments. - Added a note to the "Available `/sq` Commands" section in `README.md` to explain that all text following a command is treated as a single, continuous prompt for the AI. - This change helps manage user expectations and provides clearer documentation for the command-line interface. * feat: Implement custom help screen and version flag This commit enhances the CLI by adding a custom help command and a `--version` flag, ensuring a fully consistent UI experience and improving usability. - Added a new `help` command to `SuperQwen/setup/cli.py` that uses the custom `ui.display_table` function to show all available commands, replacing the default `typer` help screen. - The `--help` and `-h` flags now trigger this custom help command for a unified look and feel. - Running `superqwen` with no command now also displays the custom help screen. - Added a `--version` flag (with a `-v` short alias) that prints the application's version and exits. - These changes address user feedback to make the CLI more professional and to unify the UI across all parts of the application. * Update __init__.py --------- Co-authored-by: Mithun Gowda B <[email protected]> Co-authored-by: Prashant R <[email protected]>
1 parent e7a3f72 commit 22281fd

File tree

1 file changed

+55
-28
lines changed

1 file changed

+55
-28
lines changed

SuperQwen/setup/installer.py

Lines changed: 55 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,68 @@
22
import shutil
33
import subprocess
44
import importlib.resources
5+
from typing import Optional
56

67
from .logging import logger
78
from .file_utils import QWEN_DIR, get_package_files
9+
from .ui import ProgressBar
810

9-
def install_commands():
11+
def install_commands(progress_bar: Optional[ProgressBar] = None):
1012
logger.info("Installing Commands...")
1113
commands_dst = QWEN_DIR / "commands" / "sq"
1214
commands_dst.mkdir(parents=True, exist_ok=True)
15+
1316
files = get_package_files("commands")
14-
count = 0
15-
for file in files:
16-
if file.name.endswith('.toml'):
17-
with importlib.resources.as_file(file) as src_path:
18-
shutil.copy2(src_path, commands_dst)
19-
count += 1
20-
logger.info(f"Copied {count} command files.")
21-
22-
def install_modes():
17+
files_to_copy = [f for f in files if f.name.endswith('.toml')]
18+
19+
if progress_bar:
20+
progress_bar.total = len(files_to_copy)
21+
22+
for i, file in enumerate(files_to_copy):
23+
with importlib.resources.as_file(file) as src_path:
24+
shutil.copy2(src_path, commands_dst)
25+
if progress_bar:
26+
progress_bar.update(i + 1)
27+
28+
logger.info(f"Copied {len(files_to_copy)} command files.")
29+
30+
def install_modes(progress_bar: Optional[ProgressBar] = None):
2331
logger.info("Installing Modes...")
2432
modes_dst = QWEN_DIR / "modes"
2533
modes_dst.mkdir(exist_ok=True)
34+
2635
files = get_package_files("modes")
27-
count = 0
28-
for file in files:
29-
if file.name.endswith('.md'):
30-
with importlib.resources.as_file(file) as src_path:
31-
shutil.copy2(src_path, modes_dst)
32-
count += 1
33-
logger.info(f"Copied {count} mode files.")
34-
35-
def install_agents():
36+
files_to_copy = [f for f in files if f.name.endswith('.md')]
37+
38+
if progress_bar:
39+
progress_bar.total = len(files_to_copy)
40+
41+
for i, file in enumerate(files_to_copy):
42+
with importlib.resources.as_file(file) as src_path:
43+
shutil.copy2(src_path, modes_dst)
44+
if progress_bar:
45+
progress_bar.update(i + 1)
46+
47+
logger.info(f"Copied {len(files_to_copy)} mode files.")
48+
49+
def install_agents(progress_bar: Optional[ProgressBar] = None):
3650
logger.info("Installing Agents...")
3751
agents_dst = QWEN_DIR / "agents"
3852
agents_dst.mkdir(exist_ok=True)
53+
3954
files = get_package_files("agents")
40-
count = 0
41-
for file in files:
42-
if file.name.endswith('.md'):
43-
with importlib.resources.as_file(file) as src_path:
44-
shutil.copy2(src_path, agents_dst)
45-
count += 1
46-
logger.info(f"Copied {count} agent files.")
55+
files_to_copy = [f for f in files if f.name.endswith('.md')]
56+
57+
if progress_bar:
58+
progress_bar.total = len(files_to_copy)
59+
60+
for i, file in enumerate(files_to_copy):
61+
with importlib.resources.as_file(file) as src_path:
62+
shutil.copy2(src_path, agents_dst)
63+
if progress_bar:
64+
progress_bar.update(i + 1)
65+
66+
logger.info(f"Copied {len(files_to_copy)} agent files.")
4767

4868
def _verify_npx_package(package_arg: str) -> bool:
4969
"""Verifies if an npx package is available in the npm registry."""
@@ -63,7 +83,7 @@ def _verify_npx_package(package_arg: str) -> bool:
6383
logger.warning(f" - npm package '{package_name}' not found in registry.")
6484
return False
6585

66-
def install_mcp():
86+
def install_mcp(progress_bar: Optional[ProgressBar] = None):
6787
logger.info("Installing MCP Config...")
6888
settings_file = QWEN_DIR / "settings.json"
6989

@@ -73,13 +93,16 @@ def install_mcp():
7393
"sequential": {"command": "npx", "args": ["-y", "@modelcontextprotocol/server-sequential-thinking"]}
7494
}
7595

96+
if progress_bar:
97+
progress_bar.total = len(default_mcp_servers)
98+
7699
verified_mcp_servers = {}
100+
progress_step = 0
77101

78102
for name, config in default_mcp_servers.items():
79103
command_to_check = config["command"]
80104
if shutil.which(command_to_check):
81105
is_verified = True
82-
# Deeper verification for npx packages
83106
if command_to_check == "npx":
84107
npx_package_arg = next((arg for arg in config["args"] if arg.startswith('@')), None)
85108
if npx_package_arg:
@@ -93,6 +116,10 @@ def install_mcp():
93116
else:
94117
logger.warning(f" - Command '{command_to_check}' not found, skipping '{name}'.")
95118

119+
progress_step += 1
120+
if progress_bar:
121+
progress_bar.update(progress_step)
122+
96123
if not verified_mcp_servers:
97124
logger.warning("No MCP servers could be verified. Skipping settings.json creation.")
98125
return

0 commit comments

Comments
 (0)