yaicli 0.0.3__py3-none-any.whl → 0.0.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yaicli
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: A simple CLI tool to interact with LLM
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.8
@@ -0,0 +1,6 @@
1
+ yaicli.py,sha256=CY5TnPQAypGJ1FQLiryGBV4UFc8E1ZQyaNmT7ghw7NU,16741
2
+ yaicli-0.0.4.dist-info/METADATA,sha256=fY81CYJR2jcWmwElOe3rSk-wM4Lk27SZhTPdK0eHw4E,379
3
+ yaicli-0.0.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
4
+ yaicli-0.0.4.dist-info/entry_points.txt,sha256=gdduQwAuu_LeDqnDU81Fv3NPmD2tRQ1FffvolIP3S1Q,34
5
+ yaicli-0.0.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
6
+ yaicli-0.0.4.dist-info/RECORD,,
yaicli.py CHANGED
@@ -79,9 +79,7 @@ STREAM=true"""
79
79
  @self.bindings.add(Keys.ControlI) # Bind Ctrl+I to switch modes
80
80
  def _(event: KeyPressEvent):
81
81
  self.current_mode = (
82
- ModeEnum.CHAT.value
83
- if self.current_mode == ModeEnum.EXECUTE.value
84
- else ModeEnum.EXECUTE.value
82
+ ModeEnum.CHAT.value if self.current_mode == ModeEnum.EXECUTE.value else ModeEnum.EXECUTE.value
85
83
  )
86
84
 
87
85
  def detect_os(self):
@@ -272,9 +270,7 @@ Rules:
272
270
  self.console.print(f"\n[bold green]Executing command: [/bold green] {command}\n")
273
271
  result = subprocess.run(command, shell=True)
274
272
  if result.returncode != 0:
275
- self.console.print(
276
- f"\n[bold red]Command failed with return code: {result.returncode}[/bold red]"
277
- )
273
+ self.console.print(f"\n[bold red]Command failed with return code: {result.returncode}[/bold red]")
278
274
 
279
275
  def get_prompt_tokens(self):
280
276
  """Get prompt tokens based on current mode"""
@@ -383,9 +379,7 @@ Rules:
383
379
  # Load configuration
384
380
  self.config = self.load_config()
385
381
  if not self.config.get("API_KEY", None):
386
- self.console.print(
387
- "[red]API key not found. Please set it in the configuration file.[/red]"
388
- )
382
+ self.console.print("[red]API key not found. Please set it in the configuration file.[/red]")
389
383
  return
390
384
 
391
385
  # Set initial mode
@@ -418,10 +412,10 @@ CONTEXT_SETTINGS = {
418
412
  }
419
413
 
420
414
  app = typer.Typer(
421
- name="ShellAI",
415
+ name="yaicli",
422
416
  context_settings=CONTEXT_SETTINGS,
423
417
  pretty_exceptions_enable=False,
424
- short_help="ShellAI Command Line Tool",
418
+ short_help="yaicli. Your AI interface in cli.",
425
419
  no_args_is_help=True,
426
420
  invoke_without_command=True,
427
421
  )
@@ -429,16 +423,17 @@ app = typer.Typer(
429
423
 
430
424
  @app.command()
431
425
  def main(
432
- prompt: Annotated[str, typer.Argument(show_default=False, help="The prompt send to the LLM")],
433
- verbose: Annotated[
434
- bool, typer.Option("--verbose", "-V", help="Show verbose information")
435
- ] = False,
426
+ ctx: typer.Context,
427
+ prompt: Annotated[str, typer.Argument(show_default=False, help="The prompt send to the LLM")] = "",
428
+ verbose: Annotated[bool, typer.Option("--verbose", "-V", help="Show verbose information")] = False,
436
429
  chat: Annotated[bool, typer.Option("--chat", "-c", help="Start in chat mode")] = False,
437
- shell: Annotated[
438
- bool, typer.Option("--shell", "-s", help="Generate and execute shell command")
439
- ] = False,
430
+ shell: Annotated[bool, typer.Option("--shell", "-s", help="Generate and execute shell command")] = False,
440
431
  ):
441
- """LLM CLI Tool"""
432
+ """yaicli. Your AI interface in cli."""
433
+ if not prompt and not chat:
434
+ typer.echo(ctx.get_help())
435
+ raise typer.Exit()
436
+
442
437
  cli = ShellAI(verbose=verbose)
443
438
  cli.run(chat=chat, shell=shell, prompt=prompt)
444
439
 
@@ -1,6 +0,0 @@
1
- yaicli.py,sha256=4c-cGPzZlUPdqv8uZrWmiimlCp8Q8S9UH7jKHRWYI8U,16709
2
- yaicli-0.0.3.dist-info/METADATA,sha256=3C60zYZfELyBiKNPqXyPKKqAh8cKe7FG42oc_Esr01Y,379
3
- yaicli-0.0.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
4
- yaicli-0.0.3.dist-info/entry_points.txt,sha256=gdduQwAuu_LeDqnDU81Fv3NPmD2tRQ1FffvolIP3S1Q,34
5
- yaicli-0.0.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
6
- yaicli-0.0.3.dist-info/RECORD,,
File without changes