forked from yusufkaraaslan/Skill_Seekers
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquickstart.py
More file actions
190 lines (158 loc) · 5.22 KB
/
Copy pathquickstart.py
File metadata and controls
190 lines (158 loc) · 5.22 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#!/usr/bin/env python3
"""
Quickstart script for Continue.dev + Skill Seekers integration.
Usage:
python quickstart.py --framework vue
python quickstart.py --framework django --skip-scrape
"""
import argparse
import json
import subprocess
import sys
from pathlib import Path
def run_command(cmd: list[str], description: str) -> bool:
"""Run a shell command and return success status."""
print(f"\n{'='*60}")
print(f"STEP: {description}")
print(f"{'='*60}")
print(f"Running: {' '.join(cmd)}\n")
result = subprocess.run(cmd, capture_output=True, text=True)
if result.stdout:
print(result.stdout)
if result.stderr:
print(result.stderr, file=sys.stderr)
if result.returncode != 0:
print(f"❌ ERROR: {description} failed with code {result.returncode}")
return False
print(f"✅ SUCCESS: {description}")
return True
def create_continue_config(framework: str, port: int = 8765) -> Path:
"""
Create Continue.dev configuration.
Args:
framework: Framework name
port: Context server port
Returns:
Path to created config file
"""
config_dir = Path.home() / ".continue"
config_dir.mkdir(exist_ok=True)
config_path = config_dir / "config.json"
# Load existing config or create new
if config_path.exists():
with open(config_path, 'r') as f:
config = json.load(f)
else:
config = {
"models": [],
"contextProviders": []
}
# Add context provider for this framework
provider = {
"name": "http",
"params": {
"url": f"http://localhost:{port}/docs/{framework}",
"title": f"{framework}-docs",
"displayTitle": f"{framework.title()} Documentation",
"description": f"{framework} framework expert knowledge"
}
}
# Check if already exists
existing = [
p for p in config.get("contextProviders", [])
if p.get("params", {}).get("title") == provider["params"]["title"]
]
if not existing:
config.setdefault("contextProviders", []).append(provider)
print(f"✅ Added {framework} context provider to Continue config")
else:
print(f"⏭️ {framework} context provider already exists in Continue config")
# Save config
with open(config_path, 'w') as f:
json.dump(config, f, indent=2)
return config_path
def main():
parser = argparse.ArgumentParser(
description="Quickstart script for Continue.dev + Skill Seekers"
)
parser.add_argument(
"--framework",
type=str,
required=True,
help="Framework to generate documentation for (vue, react, django, etc.)"
)
parser.add_argument(
"--skip-scrape",
action="store_true",
help="Skip scraping step (use existing output)"
)
parser.add_argument(
"--port",
type=int,
default=8765,
help="Context server port (default: 8765)"
)
args = parser.parse_args()
framework = args.framework.lower()
output_dir = Path(f"output/{framework}")
print("=" * 60)
print("Continue.dev + Skill Seekers Quickstart")
print("=" * 60)
print(f"Framework: {framework}")
print(f"Context server port: {args.port}")
print("=" * 60)
# Step 1: Scrape documentation (unless skipped)
if not args.skip_scrape:
if not run_command(
[
"skill-seekers",
"scrape",
"--config",
f"configs/{framework}.json"
],
f"Scraping {framework} documentation"
):
return 1
else:
print(f"\n⏭️ SKIPPED: Using existing {output_dir}")
if not output_dir.exists():
print(f"❌ ERROR: {output_dir} does not exist!")
print(f"Run without --skip-scrape to generate documentation first.")
return 1
# Step 2: Package documentation
if not run_command(
[
"skill-seekers",
"package",
str(output_dir),
"--target",
"markdown"
],
f"Packaging {framework} documentation"
):
return 1
# Step 3: Create Continue config
print(f"\n{'='*60}")
print(f"STEP: Configuring Continue.dev")
print(f"{'='*60}")
config_path = create_continue_config(framework, args.port)
print(f"✅ Continue config updated: {config_path}")
# Step 4: Instructions for starting server
print(f"\n{'='*60}")
print(f"✅ SUCCESS: Setup complete!")
print(f"{'='*60}")
print(f"\nNext steps:")
print(f"\n1. Start context server:")
print(f" python context_server.py --port {args.port}")
print(f"\n2. Open any IDE with Continue.dev:")
print(f" - VS Code: code my-project/")
print(f" - IntelliJ: idea my-project/")
print(f" - PyCharm: pycharm my-project/")
print(f"\n3. Test in Continue panel (Cmd+L or Ctrl+L):")
print(f" @{framework}-docs Create a {framework} component")
print(f"\n4. Verify Continue references documentation")
print(f"\nContinue config location: {config_path}")
print(f"Context provider: @{framework}-docs")
return 0
if __name__ == "__main__":
sys.exit(main())