pi-fast-subagent 0.2.0 → 0.3.0
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/README.md +18 -0
- package/index.ts +66 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -59,6 +59,24 @@ model: anthropic/claude-haiku-4-5
|
|
|
59
59
|
You are code exploration specialist. Read relevant files, trace data flow, summarize findings clearly.
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
+
## Slash Commands
|
|
63
|
+
|
|
64
|
+
### `/agent`
|
|
65
|
+
|
|
66
|
+
List all available agents:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
/agent
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Show details for a specific agent (description, file path, model, tools, system prompt):
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
/agent scout
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Tab-completion is supported for agent names.
|
|
79
|
+
|
|
62
80
|
## Usage
|
|
63
81
|
|
|
64
82
|
### List agents
|
package/index.ts
CHANGED
|
@@ -457,6 +457,72 @@ const SubagentParams = Type.Object({
|
|
|
457
457
|
// ─── Extension entry point ────────────────────────────────────────────────────
|
|
458
458
|
|
|
459
459
|
export default function (pi: ExtensionAPI) {
|
|
460
|
+
// ─── /agent slash command ─────────────────────────────────────────────────
|
|
461
|
+
pi.registerCommand("agent", {
|
|
462
|
+
description: "List available subagents. Usage: /agent [name] — show details for a specific agent.",
|
|
463
|
+
getArgumentCompletions(prefix: string) {
|
|
464
|
+
const agents = discoverAgents(process.cwd());
|
|
465
|
+
return agents
|
|
466
|
+
.filter((a) => a.name.startsWith(prefix))
|
|
467
|
+
.map((a) => ({ value: a.name, label: a.name, description: a.description }));
|
|
468
|
+
},
|
|
469
|
+
async handler(args: string, ctx) {
|
|
470
|
+
const agents = discoverAgents(ctx.cwd);
|
|
471
|
+
const name = args.trim();
|
|
472
|
+
|
|
473
|
+
if (name) {
|
|
474
|
+
const agent = agents.find((a) => a.name === name);
|
|
475
|
+
if (!agent) {
|
|
476
|
+
const list = agents.map((a) => a.name).join(", ") || "none";
|
|
477
|
+
ctx.ui.notify(`Unknown agent "${name}". Available: ${list}`, "warning");
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
const lines = [
|
|
481
|
+
`## ${agent.name} [${agent.source}]`,
|
|
482
|
+
`File: ${agent.filePath}`,
|
|
483
|
+
`Description: ${agent.description}`,
|
|
484
|
+
agent.model ? `Model: ${agent.model}` : "",
|
|
485
|
+
agent.tools ? `Tools: ${agent.tools.join(", ")}` : "",
|
|
486
|
+
agent.systemPrompt ? `\nSystem prompt:\n${agent.systemPrompt}` : "",
|
|
487
|
+
].filter(Boolean).join("\n");
|
|
488
|
+
ctx.ui.notify(lines, "info");
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
if (agents.length === 0) {
|
|
493
|
+
ctx.ui.notify(
|
|
494
|
+
"No agents found.\n" +
|
|
495
|
+
"Add .md files to:\n" +
|
|
496
|
+
" ~/.pi/agent/agents/ (user-level)\n" +
|
|
497
|
+
" .pi/agents/ (project-level)\n" +
|
|
498
|
+
"\nFrontmatter required: name, description. Optional: model, tools.",
|
|
499
|
+
"info"
|
|
500
|
+
);
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
const userAgents = agents.filter((a) => a.source === "user");
|
|
505
|
+
const projectAgents = agents.filter((a) => a.source === "project");
|
|
506
|
+
|
|
507
|
+
const lines: string[] = [`Agents (${agents.length}):`];
|
|
508
|
+
if (projectAgents.length) {
|
|
509
|
+
lines.push("\nProject (.pi/agents/):");
|
|
510
|
+
for (const a of projectAgents) {
|
|
511
|
+
lines.push(` ${a.name}${a.model ? ` [${a.model}]` : ""} — ${a.description}`);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
if (userAgents.length) {
|
|
515
|
+
lines.push("\nUser (~/.pi/agent/agents/):");
|
|
516
|
+
for (const a of userAgents) {
|
|
517
|
+
lines.push(` ${a.name}${a.model ? ` [${a.model}]` : ""} — ${a.description}`);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
lines.push("");
|
|
521
|
+
lines.push("Tip: /agent <name> for details · Add .md files to .pi/agents/ to create new agents");
|
|
522
|
+
ctx.ui.notify(lines.join("\n"), "info");
|
|
523
|
+
},
|
|
524
|
+
});
|
|
525
|
+
|
|
460
526
|
pi.registerTool({
|
|
461
527
|
name: "subagent",
|
|
462
528
|
label: "Subagent",
|