Files
Netcatty/skills/netcatty-tool-cli/references/exec.md
T
8017c144fe feat(cli): bind Skills+CLI chat session via host env (#3347)
* feat(workspace): search hosts by tag (#3001)

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(cli): bind Skills+CLI chat session via host env

Hide --chat-session from agents so they cannot spoof another chat tenant.
The host injects NETCATTY_CLI_CHAT_SESSION_ID, and Copilot/CodeBuddy
approval gates reject leftover flags and env-prefix overrides.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(ai): isolate Skills+CLI chat env across concurrent SDK turns

Cursor and OpenCode mutate process.env around spawn. Serialize those
writes so overlapping chats cannot inherit or restore the wrong
NETCATTY_CLI_CHAT_SESSION_ID.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Revert "feat(workspace): search hosts by tag (#3001)"

This reverts commit 4b651a3841.

* fix(ai): preserve chat isolation when cancelling Cursor startup

* fix(ai): isolate Cursor turns in cancellable workers

* fix(ai): contain native Cursor cleanup in a utility process

* fix(ai): report Cursor utility process fatal errors

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com>
2026-09-12 12:16:57 +08:00

32 lines
2.0 KiB
Markdown

# Exec Reference
Use this reference for remote command execution tasks.
## Shortest Path
`exec` calls are internal agent transport calls. Always include `--session <session-id>`. The current chat session is already bound in the host environment.
After `--`, pass exactly one shell-ready command string. Preserve any quoting inside that one argument instead of splitting it into multiple tokens.
1. If the host prompt already gives a connected default target session, prefer it directly:
- `<netcatty-cli-prefix> session --session <default-session-id> --json`
- `<netcatty-cli-prefix> exec --session <default-session-id> --json -- <command>`
2. Otherwise:
- `<netcatty-cli-prefix> env --json`
- Choose a `connected` session.
- `<netcatty-cli-prefix> session --session <session-id> --json`
- `<netcatty-cli-prefix> exec --session <session-id> --json -- <command>`
## Rules
- Use `exec` only for command-style tasks expected to finish within about 60 seconds, such as hostname, IP address, CPU info, memory info, disk usage, pwd, whoami, uname, or process checks.
- Use long-running jobs for builds, scans, migrations, watch mode, `tail -f`, `ping`, log-following, or anything likely to exceed that budget or stream output for an extended period.
- Long-running flow:
- `<netcatty-cli-prefix> job-start --session <session-id> --json -- <command>`
- wait before polling unless the output clearly justifies checking sooner
- `<netcatty-cli-prefix> job-poll --job <job-id> --offset <offset> --json`
- if the user asks to stop it: `<netcatty-cli-prefix> job-stop --job <job-id> --json`
- Prefer one straightforward command over temporary scripts or multi-step shell orchestration.
- Avoid shell command substitution such as `$()` and backticks, because Netcatty safety policy may block them.
- Avoid wrapping simple commands in `sh -c`, `bash -c`, or similar shell launchers unless truly necessary.
- Only write a script when the task genuinely needs branching, loops, or structured parsing that cannot fit cleanly in one direct command.