Documentation
¶
Overview ¶
Package cursor implements testagent's "cursor" subcommand — the v1 drop-in fake for Cursor CLI (cursor agent). Vendor-specific knobs (cursor-shaped flags, the .cursor/{mcp,hooks}.json loaders, .cursor/rules/*.mdc surfacing, AGENTS.md surfacing, stream-json emission) live here; the shared engine loop in internal/engine drives the actual interactive session. Typed tool_call frames in stream-json remain a follow-up — see cursor-adapter-plan.md.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCommand ¶
NewCommand returns the "cursor" subcommand wired against the given root flags. The bare `testagent cursor` invocation drops into the shared engine loop; subcommands (login/logout/status/about/models/update/ create-chat/resume/ls/mcp) handle one-shot CLI surface.
Types ¶
type Config ¶
type Config struct {
MCP *MCPConfig
Hooks *HooksConfig
}
Config is the combined project + user config loaded by loadConfig. Either field may be nil if the corresponding file is absent.
type HookEntry ¶
type HookEntry struct {
Command string `json:"command"`
Type string `json:"type,omitempty"`
Matcher string `json:"matcher,omitempty"`
Timeout int `json:"timeout,omitempty"`
LoopLimit *int `json:"loop_limit,omitempty"`
FailClosed bool `json:"failClosed,omitempty"`
}
HookEntry is one hook handler under a Cursor hook event. Mirrors the schema at cursor.com/docs/hooks. Type defaults to "command" when absent; LoopLimit is a pointer so null and absent are distinguishable.
type HooksConfig ¶
type HooksConfig struct {
Version int `json:"version"`
Hooks map[string][]HookEntry `json:"hooks"`
}
HooksConfig is the on-disk shape of .cursor/hooks.json. Version must be 1; any other value is rejected by loadHooksConfig.
type MCPConfig ¶
type MCPConfig struct {
MCPServers map[string]cursorMCPServer `json:"mcpServers"`
}
MCPConfig is the on-disk shape of .cursor/mcp.json and ~/.cursor/mcp.json. Uses cursorMCPServer to capture the full on-disk field set including stdio transport fields and the Disabled toggle. Conversion to mcp.Server happens at the launch boundary via toCoreServer().
type RuleFile ¶
RuleFile is the parsed shape of one .cursor/rules/*.mdc entry. Activation mode is derived per cursor.com/docs/rules:
- AlwaysApply=true → "always" (loaded into every chat)
- Globs non-empty → "glob" (auto-attached when a match is in context)
- Description non-empty → "intelligent" (agent decides)
- (none of the above) → "manual" (only via @rule-name mention)
Mode priority is the order listed above; alwaysApply wins over a glob rule that also sets it, matching cursor's described activation precedence.