Package com.tnsai.tools.goose
Class GooseTools
java.lang.Object
com.tnsai.tools.goose.GooseTools
Function-shape Goose-style desktop tools — git CLI wrapper, screen
capture, and system info. Replaces the legacy
GitTool,
ScreenshotTool, and SystemInfoTool. Heavier legacy tools
(ClipboardTool, ContextManagerTool, MemoryStoreTool)
are deferred — clipboard + context-manager are stateful patterns that
need their own design pass; memory_store overlaps with the existing
MemoryTools.
| Method | Backend | Idempotent |
|---|---|---|
gitStatus(java.lang.String) | git status -s subprocess | true (read-only) |
gitLog(java.lang.String, int, java.lang.String) | git log subprocess | true |
gitDiff(java.lang.String, boolean, java.lang.String) | git diff subprocess | true |
gitBranches(java.lang.String, boolean) | git branch subprocess | true |
screenshot(java.lang.String) | Robot screen capture | false (state changes between calls) |
systemInfo() | JMX OperatingSystemMXBean + RuntimeMXBean | true (read-only OS / JVM facts) |
git tools are all read-only — no commit / push / reset. Pure-OS;
no API key, no network for screenshot / system_info; git tools require
the git binary on PATH.
- Since:
- 0.5.7 (Phase 2 batch 26 — built-in tool migration to function shape, see #188)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongitBranches(String workingDir, boolean includeRemote) screenshot(String outputPath)
-
Constructor Details
-
GooseTools
public GooseTools()
-
-
Method Details
-
gitStatus
@Tool(name="git_status", description="Run `git status --short` in {workingDir} (defaults to the JVM\'s working directory). Returns the short-status output (each line: \"XY filename\"). Empty output \u2192 clean working tree. Requires the `git` binary on PATH.", keywords={"git","status","vcs","working tree"}, idempotent=true) public String gitStatus(@ToolParam(description="Working directory (defaults to the JVM\'s CWD)",required=false,defaultValue="") String workingDir) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
gitLog
@Tool(name="git_log", description="Show commit history in {workingDir} (defaults to the JVM\'s CWD). {count} clamps to [1, 200] (default 10). Optional {file} narrows to commits touching one path. Returns one line per commit (hash, author, date, subject \u2014 short format).", keywords={"git","log","commits","history"}, idempotent=true) public String gitLog(@ToolParam(description="Working directory (defaults to the JVM\'s CWD)",required=false,defaultValue="") String workingDir, @ToolParam(description="Max commits (1..200); 0 \u2192 default 10",required=false,defaultValue="0") int count, @ToolParam(description="Optional file path to narrow the log",required=false,defaultValue="") String file) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
gitDiff
@Tool(name="git_diff", description="Show changes in {workingDir} (defaults to the JVM\'s CWD). {staged}=true \u2192 staged changes, false \u2192 unstaged. Optional {file} narrows to one path. Returns the unified diff output.", keywords={"git","diff","changes","staged"}, idempotent=true) public String gitDiff(@ToolParam(description="Working directory (defaults to the JVM\'s CWD)",required=false,defaultValue="") String workingDir, @ToolParam(description="true \u2192 diff staged (--cached); false \u2192 unstaged",required=false,defaultValue="false") boolean staged, @ToolParam(description="Optional file path to narrow the diff",required=false,defaultValue="") String file) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
gitBranches
@Tool(name="git_branches", description="List branches in {workingDir} (defaults to the JVM\'s CWD). {includeRemote}=true adds remote-tracking branches. Returns one branch per line \u2014 the current branch is marked with a leading \"*\".", keywords={"git","branches","branch","list"}, idempotent=true) public String gitBranches(@ToolParam(description="Working directory (defaults to the JVM\'s CWD)",required=false,defaultValue="") String workingDir, @ToolParam(description="true \u2192 include remote branches (-a)",required=false,defaultValue="false") boolean includeRemote) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
screenshot
@Tool(name="screenshot", description="Capture the primary screen and write it as a PNG to {outputPath}. Returns the absolute path of the written file. NOT idempotent \u2014 the screen contents change between calls. Requires AWT Robot (fails fast in headless JVMs).", keywords={"screenshot","screen","capture","image"}, idempotent=false) public String screenshot(@ToolParam(description="Absolute output path (.png recommended)") String outputPath) throws IOException - Throws:
IOException
-
systemInfo
@Tool(name="system_info", description="Return OS / JVM / hardware facts in a single map: os.name / os.version / os.arch / user.name / hostname / cpu.cores / memory.heap.used / memory.heap.max / jvm.version / jvm.vendor / jvm.uptime.seconds. Pure JMX read; no auth.", keywords={"system","info","os","cpu","memory","jvm"}, idempotent=true) public Map<String,Object> systemInfo()
-