@musashishao/agent-kit 1.4.0 → 1.4.1
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.
- package/.agent/scripts/ak_cli.py +31 -12
- package/package.json +1 -1
package/.agent/scripts/ak_cli.py
CHANGED
|
@@ -179,17 +179,25 @@ def cmd_init(args: argparse.Namespace) -> int:
|
|
|
179
179
|
print(f"\n[{steps_completed + 1}/{total_steps}] Generating dependency graph...")
|
|
180
180
|
graph_script = kit_path / "skills" / "graph-mapper" / "scripts" / "generate_graph.py"
|
|
181
181
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
# Smart source detection
|
|
183
|
+
src_dir = None
|
|
184
|
+
for folder in ["src", "app", "lib", "scripts", "components", "docs"]:
|
|
185
|
+
if (project_root / folder).exists():
|
|
186
|
+
src_dir = project_root / folder
|
|
187
|
+
break
|
|
185
188
|
|
|
186
|
-
if src_dir
|
|
189
|
+
if src_dir is None:
|
|
190
|
+
# Fallback to project root
|
|
191
|
+
src_dir = project_root
|
|
192
|
+
|
|
193
|
+
if graph_script.exists():
|
|
187
194
|
result = subprocess.run(
|
|
188
195
|
[
|
|
189
196
|
"python3", str(graph_script),
|
|
190
197
|
"--src", str(src_dir),
|
|
191
198
|
"--output", str(agent_dir / "graph.json"),
|
|
192
199
|
"--format", "both",
|
|
200
|
+
"--lang", "universal",
|
|
193
201
|
],
|
|
194
202
|
capture_output=True,
|
|
195
203
|
text=True,
|
|
@@ -199,7 +207,7 @@ def cmd_init(args: argparse.Namespace) -> int:
|
|
|
199
207
|
else:
|
|
200
208
|
print(" ⚠️ No source code found or script failed")
|
|
201
209
|
else:
|
|
202
|
-
print(" ⚠️
|
|
210
|
+
print(" ⚠️ Graph script not found, skipping")
|
|
203
211
|
steps_completed += 1
|
|
204
212
|
|
|
205
213
|
# Step 5: Configure AI hosts
|
|
@@ -260,18 +268,25 @@ def cmd_init(args: argparse.Namespace) -> int:
|
|
|
260
268
|
|
|
261
269
|
def find_source_dir(project_root: Path) -> Path:
|
|
262
270
|
"""Intelligently find the source directory."""
|
|
263
|
-
# Priority
|
|
271
|
+
# Priority folders
|
|
264
272
|
for folder in ["src", "app", "lib", "scripts", "components"]:
|
|
265
273
|
if (project_root / folder).exists():
|
|
266
274
|
return project_root / folder
|
|
267
275
|
|
|
268
|
-
#
|
|
269
|
-
source_extensions = {".ts", ".tsx", ".js", ".jsx", ".py", ".go", ".c", ".cpp", ".cs"}
|
|
276
|
+
# Check if there are source files in root
|
|
277
|
+
source_extensions = {".ts", ".tsx", ".js", ".jsx", ".py", ".go", ".c", ".cpp", ".cs", ".md"}
|
|
278
|
+
has_source_files = False
|
|
270
279
|
for item in project_root.iterdir():
|
|
271
280
|
if item.is_file() and item.suffix in source_extensions:
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
281
|
+
has_source_files = True
|
|
282
|
+
break
|
|
283
|
+
|
|
284
|
+
# Check for docs folder
|
|
285
|
+
if (project_root / "docs").exists():
|
|
286
|
+
return project_root / "docs"
|
|
287
|
+
|
|
288
|
+
# Fallback: use project root if it has any content, otherwise return root anyway
|
|
289
|
+
return project_root
|
|
275
290
|
|
|
276
291
|
|
|
277
292
|
def cmd_sync(args: argparse.Namespace) -> int:
|
|
@@ -308,7 +323,7 @@ def cmd_sync(args: argparse.Namespace) -> int:
|
|
|
308
323
|
if not graph_script.exists():
|
|
309
324
|
print(f" ❌ Graph script not found at: {graph_script}")
|
|
310
325
|
success = False
|
|
311
|
-
elif not src_dir.exists()
|
|
326
|
+
elif not src_dir.exists():
|
|
312
327
|
print(f" ⚠️ Source directory {src_dir} not found")
|
|
313
328
|
else:
|
|
314
329
|
result = subprocess.run(
|
|
@@ -317,6 +332,7 @@ def cmd_sync(args: argparse.Namespace) -> int:
|
|
|
317
332
|
"--src", str(src_dir),
|
|
318
333
|
"--output", str(agent_dir / "graph.json"),
|
|
319
334
|
"--format", "both",
|
|
335
|
+
"--lang", "universal",
|
|
320
336
|
],
|
|
321
337
|
capture_output=True,
|
|
322
338
|
text=True,
|
|
@@ -335,12 +351,15 @@ def cmd_sync(args: argparse.Namespace) -> int:
|
|
|
335
351
|
if not rag_script.exists():
|
|
336
352
|
print(f" ❌ RAG script not found at: {rag_script}")
|
|
337
353
|
success = False
|
|
354
|
+
elif not src_dir.exists():
|
|
355
|
+
print(f" ⚠️ Source directory {src_dir} not found")
|
|
338
356
|
else:
|
|
339
357
|
result = subprocess.run(
|
|
340
358
|
[
|
|
341
359
|
"python3", str(rag_script),
|
|
342
360
|
"--src", str(src_dir),
|
|
343
361
|
"--output", str(agent_dir / "rag" / "chunks.json"),
|
|
362
|
+
"--lang", "universal",
|
|
344
363
|
],
|
|
345
364
|
capture_output=True,
|
|
346
365
|
text=True,
|