Skip to content

Commit

Permalink
Fix in task input
Browse files Browse the repository at this point in the history
- Updated CLI command arguments for tasks to remove unnecessary prompts and improve user experience
- Modified `execute_task.ts` to handle different input modes (clipboard, prompt file) based on user options or environment settings
- Bumped version number in `package.json` to 0.0.15
  • Loading branch information
synw committed Oct 16, 2024
1 parent daba913 commit b0c2190
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/cli/bin/cmd/clicmds/cmds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ let cmds: Record<string, Cmd> = {
t: {
cmd: _executeTaskCmd,
description: "execute a task",
args: "arguments: \n-task (required): the task name\n-args: prompt and other arguments if any for the task"
//args: "arguments: \n-task (required): the task name\n-args: prompt and other arguments if any for the task"
},
j: {
cmd: _executeJobCmd,
Expand Down Expand Up @@ -69,7 +69,7 @@ function initAliases(): Record<string, Cmd> {
_cmds[alias.name] = {
cmd: (args: Array<string> = [], options: any) => _executeTaskCmd([alias.name, ...args], options),
description: "task: " + alias.name,
args: "arguments: \n-args: prompt and other arguments if any for the task"
//args: "arguments: \n-args: prompt and other arguments if any for the task"
}
break;
case "action":
Expand Down
8 changes: 5 additions & 3 deletions packages/cli/bin/cmd/lib/execute_task.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { brain, initAgent, taskBuilder } from "../../agent.js";
import { getFeatureSpec } from "../../state/features.js";
import { FeatureType } from "../../interfaces.js";
import { isDebug, runMode } from "../../state/state.js";
import { initTaskVars, readTask } from "./utils.js";
import { inputMode, isDebug, runMode } from "../../state/state.js";
import { initTaskVars, readPromptFile, readTask } from "./utils.js";
import { readClipboard } from "../sys/clipboard.js";

async function executeTaskCmd(args: Array<string> = [], options: any = {}): Promise<any> {
Expand All @@ -13,9 +13,11 @@ async function executeTaskCmd(args: Array<string> = [], options: any = {}): Prom
const params = args.filter((x) => x.length > 0);
//console.log("Task run params", params);
let pr: string;
if (options?.Ic == true) {
if (options?.Ic == true || inputMode.value == "clipboard") {
//console.log("Input copy option");
pr = await readClipboard()
} else if (options.Pf || inputMode.value == "promptfile") {
pr = readPromptFile()
}
else if (params.length > 0) {
pr = params.shift()!;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@agent-smith/cli",
"description": "Agent Smith: terminal client for language model agents",
"repository": "https://github.com/synw/agent-smith",
"version": "0.0.14",
"version": "0.0.15",
"scripts": {
"buildrl": "rm -rf dist/* && rollup -c",
"build": "rm -rf dist/* && tsc",
Expand Down

0 comments on commit b0c2190

Please sign in to comment.