skilllite 0.1.0__py3-none-any.whl → 0.1.1__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.
skilllite/cli.py DELETED
@@ -1,217 +0,0 @@
1
- """
2
- Command-line interface for skilllite.
3
-
4
- Provides commands for managing the skillbox binary, similar to
5
- how Playwright provides `playwright install` for browser management.
6
-
7
- Usage:
8
- skilllite install # Download and install the sandbox binary
9
- skilllite uninstall # Remove the installed binary
10
- skilllite status # Show installation status
11
- skilllite version # Show version information
12
- skilllite mcp # Start MCP server
13
- """
14
-
15
- import argparse
16
- import sys
17
- from typing import List, Optional
18
-
19
- from . import __version__
20
- from .sandbox.skillbox import (
21
- BINARY_VERSION,
22
- get_platform,
23
- install,
24
- is_installed,
25
- get_installed_version,
26
- uninstall,
27
- )
28
-
29
-
30
- def print_status() -> None:
31
- """Print installation status."""
32
- from .sandbox.skillbox import find_binary, get_binary_path
33
-
34
- print("SkillLite Installation Status")
35
- print("=" * 40)
36
-
37
- if is_installed():
38
- version = get_installed_version()
39
- print(f"✓ skillbox is installed (v{version})")
40
- print(f" Location: {get_binary_path()}")
41
- else:
42
- binary = find_binary()
43
- if binary:
44
- print(f"✓ skillbox found at: {binary}")
45
- else:
46
- print("✗ skillbox is not installed")
47
- print(" Install with: skilllite install")
48
-
49
- def cmd_install(args: argparse.Namespace) -> int:
50
- """Install the skillbox binary."""
51
- try:
52
- install(
53
- version=args.version,
54
- force=args.force,
55
- show_progress=not args.quiet
56
- )
57
- return 0
58
- except Exception as e:
59
- print(f"Error: {e}", file=sys.stderr)
60
- return 1
61
-
62
- def cmd_uninstall(args: argparse.Namespace) -> int:
63
- """Uninstall the skillbox binary."""
64
- try:
65
- uninstall()
66
- return 0
67
- except Exception as e:
68
- print(f"Error: {e}", file=sys.stderr)
69
- return 1
70
-
71
- def cmd_status(args: argparse.Namespace) -> int:
72
- """Show installation status."""
73
- try:
74
- print_status()
75
- return 0
76
- except Exception as e:
77
- print(f"Error: {e}", file=sys.stderr)
78
- return 1
79
-
80
- def cmd_version(args: argparse.Namespace) -> int:
81
- """Show version information."""
82
- print(f"skilllite Python SDK: v{__version__}")
83
- print(f"skillbox binary (bundled): v{BINARY_VERSION}")
84
-
85
- installed_version = get_installed_version()
86
- if installed_version:
87
- print(f"skillbox binary (installed): v{installed_version}")
88
- else:
89
- print("skillbox binary (installed): not installed")
90
-
91
- try:
92
- plat = get_platform()
93
- print(f"Platform: {plat}")
94
- except RuntimeError as e:
95
- print(f"Platform: {e}")
96
-
97
- return 0
98
-
99
- def cmd_mcp_server(args: argparse.Namespace) -> int:
100
- """Start MCP server."""
101
- try:
102
- import asyncio
103
- from .mcp.server import main as mcp_main
104
-
105
- asyncio.run(mcp_main())
106
- return 0
107
- except ImportError as e:
108
- print("Error: MCP integration not available", file=sys.stderr)
109
- print("Please install it with: pip install skilllite[mcp]", file=sys.stderr)
110
- return 1
111
- except KeyboardInterrupt:
112
- print("\nMCP server stopped by user", file=sys.stderr)
113
- return 0
114
- except Exception as e:
115
- import traceback
116
- print(f"Error starting MCP server: {e}", file=sys.stderr)
117
- traceback.print_exc()
118
- return 1
119
-
120
- def create_parser() -> argparse.ArgumentParser:
121
- """Create the argument parser."""
122
- parser = argparse.ArgumentParser(
123
- prog="skilllite",
124
- description="SkillLite - A lightweight Skills execution engine with LLM integration",
125
- formatter_class=argparse.RawDescriptionHelpFormatter,
126
- epilog="""
127
- Examples:
128
- skilllite install Install the sandbox binary
129
- skilllite install --force Force reinstall
130
- skilllite status Check installation status
131
- skilllite uninstall Remove the binary
132
- skilllite mcp Start MCP server (requires pip install skilllite[mcp])
133
-
134
- For more information, visit: https://github.com/skilllite/skilllite
135
- """
136
- )
137
-
138
- parser.add_argument(
139
- "-V", "--version",
140
- action="store_true",
141
- help="Show version information"
142
- )
143
-
144
- subparsers = parser.add_subparsers(dest="command", help="Available commands")
145
-
146
- # install command
147
- install_parser = subparsers.add_parser(
148
- "install",
149
- help="Download and install the skillbox sandbox binary"
150
- )
151
- install_parser.add_argument(
152
- "--version",
153
- dest="version",
154
- default=None,
155
- help=f"Version to install (default: {BINARY_VERSION})"
156
- )
157
- install_parser.add_argument(
158
- "--force", "-f",
159
- action="store_true",
160
- help="Force reinstall even if already installed"
161
- )
162
- install_parser.add_argument(
163
- "--quiet", "-q",
164
- action="store_true",
165
- help="Suppress progress output"
166
- )
167
- install_parser.set_defaults(func=cmd_install)
168
-
169
- # uninstall command
170
- uninstall_parser = subparsers.add_parser(
171
- "uninstall",
172
- help="Remove the installed skillbox binary"
173
- )
174
- uninstall_parser.set_defaults(func=cmd_uninstall)
175
-
176
- # status command
177
- status_parser = subparsers.add_parser(
178
- "status",
179
- help="Show installation status"
180
- )
181
- status_parser.set_defaults(func=cmd_status)
182
-
183
- # version command (alternative to -V)
184
- version_parser = subparsers.add_parser(
185
- "version",
186
- help="Show version information"
187
- )
188
- version_parser.set_defaults(func=cmd_version)
189
-
190
- # mcp command
191
- mcp_parser = subparsers.add_parser(
192
- "mcp",
193
- help="Start MCP server for SkillLite"
194
- )
195
- mcp_parser.set_defaults(func=cmd_mcp_server)
196
-
197
- return parser
198
-
199
- def main(argv: Optional[List[str]] = None) -> int:
200
- """Main entry point for the CLI."""
201
- parser = create_parser()
202
- args = parser.parse_args(argv)
203
-
204
- # Handle -V/--version flag
205
- if args.version:
206
- return cmd_version(args)
207
-
208
- # Handle no command
209
- if not args.command:
210
- parser.print_help()
211
- return 0
212
-
213
- # Execute the command
214
- return args.func(args)
215
-
216
- if __name__ == "__main__":
217
- sys.exit(main())