|
|
@@ -6,6 +6,7 @@ import { Agent } from "../../agent/agent"
|
|
|
import path from "path"
|
|
|
import matter from "gray-matter"
|
|
|
import { Instance } from "../../project/instance"
|
|
|
+import { EOL } from "os"
|
|
|
|
|
|
const AgentCreateCommand = cmd({
|
|
|
command: "create",
|
|
|
@@ -133,9 +134,32 @@ const AgentCreateCommand = cmd({
|
|
|
},
|
|
|
})
|
|
|
|
|
|
+const AgentListCommand = cmd({
|
|
|
+ command: "list",
|
|
|
+ describe: "list all available agents",
|
|
|
+ async handler() {
|
|
|
+ await Instance.provide({
|
|
|
+ directory: process.cwd(),
|
|
|
+ async fn() {
|
|
|
+ const agents = await Agent.list()
|
|
|
+ const sortedAgents = agents.sort((a, b) => {
|
|
|
+ if (a.builtIn !== b.builtIn) {
|
|
|
+ return a.builtIn ? -1 : 1
|
|
|
+ }
|
|
|
+ return a.name.localeCompare(b.name)
|
|
|
+ })
|
|
|
+
|
|
|
+ for (const agent of sortedAgents) {
|
|
|
+ process.stdout.write(`${agent.name} (${agent.mode})${EOL}`)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ })
|
|
|
+ },
|
|
|
+})
|
|
|
+
|
|
|
export const AgentCommand = cmd({
|
|
|
command: "agent",
|
|
|
describe: "manage agents",
|
|
|
- builder: (yargs) => yargs.command(AgentCreateCommand).demandCommand(),
|
|
|
+ builder: (yargs) => yargs.command(AgentCreateCommand).command(AgentListCommand).demandCommand(),
|
|
|
async handler() {},
|
|
|
})
|