()
| 273 | } |
| 274 | |
| 275 | export function getSimplePrompt(): string { |
| 276 | // Ant-native builds alias find/grep to embedded bfs/ugrep in Claude's shell, |
| 277 | // so we don't steer away from them (and Glob/Grep tools are removed). |
| 278 | const embedded = hasEmbeddedSearchTools() |
| 279 | |
| 280 | const toolPreferenceItems = [ |
| 281 | ...(embedded |
| 282 | ? [] |
| 283 | : [ |
| 284 | `File search: Use ${GLOB_TOOL_NAME} (NOT find or ls)`, |
| 285 | `Content search: Use ${GREP_TOOL_NAME} (NOT grep or rg)`, |
| 286 | ]), |
| 287 | `Read files: Use ${FILE_READ_TOOL_NAME} (NOT cat/head/tail)`, |
| 288 | `Edit files: Use ${FILE_EDIT_TOOL_NAME} (NOT sed/awk)`, |
| 289 | `Write files: Use ${FILE_WRITE_TOOL_NAME} (NOT echo >/cat <<EOF)`, |
| 290 | 'Communication: Output text directly (NOT echo/printf)', |
| 291 | ] |
| 292 | |
| 293 | const avoidCommands = embedded |
| 294 | ? '`cat`, `head`, `tail`, `sed`, `awk`, or `echo`' |
| 295 | : '`find`, `grep`, `cat`, `head`, `tail`, `sed`, `awk`, or `echo`' |
| 296 | |
| 297 | const multipleCommandsSubitems = [ |
| 298 | `If the commands are independent and can run in parallel, make multiple ${BASH_TOOL_NAME} tool calls in a single message. Example: if you need to run "git status" and "git diff", send a single message with two ${BASH_TOOL_NAME} tool calls in parallel.`, |
| 299 | `If the commands depend on each other and must run sequentially, use a single ${BASH_TOOL_NAME} call with '&&' to chain them together.`, |
| 300 | "Use ';' only when you need to run commands sequentially but don't care if earlier commands fail.", |
| 301 | 'DO NOT use newlines to separate commands (newlines are ok in quoted strings).', |
| 302 | ] |
| 303 | |
| 304 | const gitSubitems = [ |
| 305 | 'Prefer to create a new commit rather than amending an existing commit.', |
| 306 | 'Before running destructive operations (e.g., git reset --hard, git push --force, git checkout --), consider whether there is a safer alternative that achieves the same goal. Only use destructive operations when they are truly the best approach.', |
| 307 | 'Never skip hooks (--no-verify) or bypass signing (--no-gpg-sign, -c commit.gpgsign=false) unless the user has explicitly asked for it. If a hook fails, investigate and fix the underlying issue.', |
| 308 | ] |
| 309 | |
| 310 | const sleepSubitems = [ |
| 311 | 'Do not sleep between commands that can run immediately — just run them.', |
| 312 | ...(feature('MONITOR_TOOL') |
| 313 | ? [ |
| 314 | 'Use the Monitor tool to stream events from a background process (each stdout line is a notification). For one-shot "wait until done," use Bash with run_in_background instead.', |
| 315 | ] |
| 316 | : []), |
| 317 | 'If your command is long running and you would like to be notified when it finishes — use `run_in_background`. No sleep needed.', |
| 318 | 'Do not retry failing commands in a sleep loop — diagnose the root cause.', |
| 319 | 'If waiting for a background task you started with `run_in_background`, you will be notified when it completes — do not poll.', |
| 320 | ...(feature('MONITOR_TOOL') |
| 321 | ? [ |
| 322 | '`sleep N` as the first command with N ≥ 2 is blocked. If you need a delay (rate limiting, deliberate pacing), keep it under 2 seconds.', |
| 323 | ] |
| 324 | : [ |
| 325 | 'If you must poll an external process, use a check command (e.g. `gh run view`) rather than sleeping first.', |
| 326 | 'If you must sleep, keep the duration short (1-5 seconds) to avoid blocking the user.', |
| 327 | ]), |
| 328 | ] |
| 329 | const backgroundNote = getBackgroundUsageNote() |
| 330 | |
| 331 | const instructionItems: Array<string | string[]> = [ |
| 332 | 'If your command will create new directories or files, first use this tool to run `ls` to verify the parent directory exists and is the correct location.', |
no test coverage detected