-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy path__main__.py
More file actions
93 lines (79 loc) · 3.23 KB
/
__main__.py
File metadata and controls
93 lines (79 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import argparse
from .cursor import generate_cursor_commands
from .mcp.server import AgentSOPMCPServer
from .rules import output_rules
from .skills import generate_anthropic_skills
# Registry for command generators: maps type -> (generator_function, default_output_dir)
COMMAND_GENERATORS = {
"cursor": (generate_cursor_commands, ".cursor/commands"),
# Future types can be added here:
# "claude": (generate_claude_commands, ".claude/commands"),
}
def main():
parser = argparse.ArgumentParser(
description="Strands Agents SOPs", prog="strands-agents-sops"
)
subparsers = parser.add_subparsers(
dest="command", help="Available commands", required=False
)
# MCP server command (default)
mcp_parser = subparsers.add_parser("mcp", help="Run MCP server (default)")
mcp_parser.add_argument(
"--sop-paths",
help="Colon-separated list of directory paths to load external SOPs from. "
"Supports absolute paths, relative paths, and tilde (~) expansion.",
)
# Skills generation command
skills_parser = subparsers.add_parser("skills", help="Generate Anthropic skills")
skills_parser.add_argument(
"--output-dir",
default="skills",
help="Output directory for skills (default: skills)",
)
skills_parser.add_argument(
"--sop-paths",
help="Colon-separated list of directory paths to load external SOPs from. "
"Supports absolute paths, relative paths, and tilde (~) expansion.",
)
# Rules output command
subparsers.add_parser("rule", help="Output agent SOP authoring rule")
# Commands generation command (supports multiple types: cursor, claude, etc.)
commands_parser = subparsers.add_parser(
"commands", help="Generate IDE commands from SOPs"
)
commands_parser.add_argument(
"--type",
required=True,
choices=list(COMMAND_GENERATORS.keys()),
help=f"Type of commands to generate ({', '.join(COMMAND_GENERATORS.keys())}, etc.)",
)
commands_parser.add_argument(
"--output-dir",
help="Output directory for commands (default varies by type)",
)
commands_parser.add_argument(
"--sop-paths",
help="Colon-separated list of directory paths to load external SOPs from. "
"Supports absolute paths, relative paths, and tilde (~) expansion.",
)
args = parser.parse_args()
if args.command == "skills":
sop_paths = getattr(args, "sop_paths", None)
generate_anthropic_skills(args.output_dir, sop_paths=sop_paths)
elif args.command == "rule":
output_rules()
elif args.command == "commands":
sop_paths = getattr(args, "sop_paths", None)
command_type = args.type
if command_type not in COMMAND_GENERATORS:
parser.error(f"Unsupported command type: {command_type}")
generator_func, default_output_dir = COMMAND_GENERATORS[command_type]
output_dir = args.output_dir or default_output_dir
generator_func(output_dir, sop_paths=sop_paths)
else:
# Default to MCP server
sop_paths = getattr(args, "sop_paths", None)
mcp_server = AgentSOPMCPServer(sop_paths=sop_paths)
mcp_server.run()
if __name__ == "__main__":
main()