From b0c21905e34dc1cef822601e75642c6b8811f850 Mon Sep 17 00:00:00 2001 From: synw Date: Wed, 16 Oct 2024 13:26:39 +0200 Subject: [PATCH] Fix in task input - 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 --- packages/cli/bin/cmd/clicmds/cmds.ts | 4 ++-- packages/cli/bin/cmd/lib/execute_task.ts | 8 +++++--- packages/cli/package.json | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/cli/bin/cmd/clicmds/cmds.ts b/packages/cli/bin/cmd/clicmds/cmds.ts index 1b92803..4c41fe8 100644 --- a/packages/cli/bin/cmd/clicmds/cmds.ts +++ b/packages/cli/bin/cmd/clicmds/cmds.ts @@ -37,7 +37,7 @@ let cmds: Record = { 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, @@ -69,7 +69,7 @@ function initAliases(): Record { _cmds[alias.name] = { cmd: (args: Array = [], 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": diff --git a/packages/cli/bin/cmd/lib/execute_task.ts b/packages/cli/bin/cmd/lib/execute_task.ts index abc34ba..110be31 100644 --- a/packages/cli/bin/cmd/lib/execute_task.ts +++ b/packages/cli/bin/cmd/lib/execute_task.ts @@ -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 = [], options: any = {}): Promise { @@ -13,9 +13,11 @@ async function executeTaskCmd(args: Array = [], 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()!; diff --git a/packages/cli/package.json b/packages/cli/package.json index 8bbe555..c7cacee 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -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",