Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub Actions Bot committed Dec 14, 2024
1 parent 611457f commit 7d0a3a1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
20 changes: 18 additions & 2 deletions packages/agent_generator/src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,23 @@ const main = async () => {
agent: "runShellAgent",
inputs: {
commands: [
"npm", "create", "graphai-agent@latest", "--", "-c", "--agentName", ":packageInfo.kebabCase", "--description", ":specLLM.tool.arguments.description", "--author", "me", "--license", "MIT", "--category", ":specLLM.tool.arguments.category", "--outdir", ":packageBaseDir",
"npm",
"create",
"graphai-agent@latest",
"--",
"-c",
"--agentName",
":packageInfo.kebabCase",
"--description",
":specLLM.tool.arguments.description",
"--author",
"me",
"--license",
"MIT",
"--category",
":specLLM.tool.arguments.category",
"--outdir",
":packageBaseDir",
],
baseDir: ":packageBaseDir",
},
Expand All @@ -135,7 +151,7 @@ const main = async () => {
inputs: {
commands: ["yarn", "install"],
dirs: [":packageBaseDir", ":packageInfo.kebabCase"],
waiting: ":createSkeleton"
waiting: ":createSkeleton",
},
},
packageDir: {
Expand Down
19 changes: 9 additions & 10 deletions system/shell-util-agent/src/run_shell_agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,26 @@ export const runShellCommand = (commands: string[], path?: string): Promise<{ te
throw new Error("runShellAgent error: command must be string[]");
}
return new Promise((resolve, reject) => {
const [command, args] = [commands[0] , commands.slice(1)];
const [command, args] = [commands[0], commands.slice(1)];
const results: string[] = [];
const stderrs: string[] = [];
const child = spawn(command, args, { cwd: path ?? process.cwd() });

child.stdout.on('data', (data: string) => {
child.stdout.on("data", (data: string) => {
results.push(data);
});
child.stderr.on('data', (data: string) => {

child.stderr.on("data", (data: string) => {
stderrs.push(data);
});

child.stderr.on('data', (data) => {
reject({error: data, stdout: results.join(""), stderr: stderrs.join("")});
child.stderr.on("data", (data) => {
reject({ error: data, stdout: results.join(""), stderr: stderrs.join("") });
});
child.on('close', () => {
resolve({ text: results.join(""), stderr: stderrs.join("")});

child.on("close", () => {
resolve({ text: results.join(""), stderr: stderrs.join("") });
});

});
};

Expand Down

0 comments on commit 7d0a3a1

Please sign in to comment.