Documentation
¶
Index ¶
- func CommitHookSupported(client ClientConfig) bool
- func ExpandConfigPath(path string) string
- func GetConfigPath(client ClientConfig) (string, error)
- func GetServerArgs() []string
- func GetServerConfig() map[string]interface{}
- func GetSkillsPath(client ClientConfig) (string, error)
- func HookScriptPath() (string, error)
- func InstallCommitHook(client ClientConfig) (scriptPath string, settingsPath string, binary string, err error)
- func InstallSkills(client ClientConfig) ([]string, error)
- func IsPlatformSupported(p Platform) bool
- func SettingsPath() (string, error)
- func SupportsSkills(client ClientConfig) bool
- func TransientBinary(binary string) bool
- func UninstallCommitHook(client ClientConfig) (bool, error)
- func UninstallSkills(client ClientConfig) ([]string, error)
- type ClientConfig
- type ClientStatus
- type ConfigFormat
- type InstallMethod
- type InstallOptions
- type InstallationResult
- type Platform
- type Skill
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommitHookSupported ¶ added in v2.11.2
func CommitHookSupported(client ClientConfig) bool
CommitHookSupported reports whether the commit hook can be installed for this client on this platform.
The hook is a bash script. On Windows, Claude Code runs hooks through PowerShell unless Git Bash is present, so shipping the bash version there would install something that silently fails on every commit. Better to say it is unsupported than to pretend.
func ExpandConfigPath ¶
ExpandConfigPath expands special variables in a config path. Supports: ~, $HOME, %APPDATA%, %USERPROFILE%
func GetConfigPath ¶
func GetConfigPath(client ClientConfig) (string, error)
GetConfigPath returns the expanded config file path for a client on the current platform. Returns empty string for CLI-based clients that don't use config files.
func GetServerArgs ¶
func GetServerArgs() []string
GetServerArgs returns the server command arguments.
func GetServerConfig ¶
func GetServerConfig() map[string]interface{}
GetServerConfig returns the MCP server configuration to add to client configs.
func GetSkillsPath ¶ added in v2.11.2
func GetSkillsPath(client ClientConfig) (string, error)
GetSkillsPath returns the directory skills are installed into for this client, or an error if the client has no skills mechanism.
func HookScriptPath ¶ added in v2.11.2
HookScriptPath returns where the hook script is written. It lives under the Kusari directory rather than the agent's, alongside the token and scan cache.
func InstallCommitHook ¶ added in v2.11.2
func InstallCommitHook(client ClientConfig) (scriptPath string, settingsPath string, binary string, err error)
InstallCommitHook writes the hook script and registers it in the user's Claude Code settings, returning the script path and the settings path.
func InstallSkills ¶ added in v2.11.2
func InstallSkills(client ClientConfig) ([]string, error)
InstallSkills writes every embedded skill into the client's skills directory, returning the names installed. Existing files are overwritten: these are managed artifacts, and an upgrade has to be able to replace an older copy.
func IsPlatformSupported ¶
IsPlatformSupported returns true if the platform is supported.
func SettingsPath ¶ added in v2.11.2
SettingsPath returns the Claude Code settings file the hook is merged into. This is user-level settings, matching where skills are installed.
func SupportsSkills ¶ added in v2.11.2
func SupportsSkills(client ClientConfig) bool
SupportsSkills reports whether this client has a skills directory on the current platform.
func TransientBinary ¶ added in v2.11.2
TransientBinary reports whether the path baked into the hook looks like a throwaway build rather than an installed binary: it is not what `kusari` resolves to on PATH.
This matters because the hook records whichever executable installed it. A developer running ./kusari out of a checkout pins the hook to a build artifact, and a later rebuild or clean silently disables it -- the script fails safe and lets commits through, so nothing announces the breakage.
func UninstallCommitHook ¶ added in v2.11.2
func UninstallCommitHook(client ClientConfig) (bool, error)
UninstallCommitHook removes our hook entry and deletes the script. Reports whether anything was actually removed.
func UninstallSkills ¶ added in v2.11.2
func UninstallSkills(client ClientConfig) ([]string, error)
UninstallSkills removes only the skills this binary ships, leaving anything the user wrote themselves alone.
Types ¶
type ClientConfig ¶
type ClientConfig struct {
// Name is the human-readable client name (e.g., "Claude Code")
Name string
// ID is the CLI identifier (e.g., "claude-code")
ID string
// ConfigPaths maps platform to config file path (for file-based install)
ConfigPaths map[string]string
// ServerKey is the key used in the mcpServers object
ServerKey string
// ConfigFormat specifies the config file format
ConfigFormat ConfigFormat
// InstallMethod specifies how to install (file or CLI)
InstallMethod InstallMethod
// CLICommand is the command to use for CLI-based install (e.g., "claude")
CLICommand string
// SkillsPaths maps platform to the directory agent skills are installed
// into. Empty means this client has no skills mechanism -- skills are a
// Claude Code construct, and the other supported editors have no equivalent,
// so installing files for them would just litter the disk.
SkillsPaths map[string]string
}
ClientConfig holds configuration for a supported MCP client.
func GetAllClients ¶
func GetAllClients() []ClientConfig
GetAllClients returns all supported MCP clients.
func GetClient ¶
func GetClient(id string) (ClientConfig, error)
GetClient returns the client configuration for the given ID. Client ID matching is case-insensitive. Also supports legacy "claude" alias for "claude-code".
type ClientStatus ¶
type ClientStatus struct {
// ClientName is the human-readable client name.
ClientName string
// ClientID is the CLI identifier.
ClientID string
// Installed indicates whether kusari-inspector is configured.
Installed bool
// ConfigPath is the path to the config file (empty for CLI-based).
ConfigPath string
// InstallMethod indicates how the client is configured.
InstallMethod InstallMethod
}
ClientStatus contains the installation status for a client.
func ListClients ¶
func ListClients(clients []ClientConfig) []ClientStatus
ListClients returns the installation status for all given clients.
type ConfigFormat ¶
type ConfigFormat int
ConfigFormat specifies the configuration file format for a client.
const ( // ConfigFormatStandard uses the mcpServers object format. ConfigFormatStandard ConfigFormat = iota // ConfigFormatContinue uses the experimental.modelContextProtocolServers array format. ConfigFormatContinue )
type InstallMethod ¶
type InstallMethod int
InstallMethod specifies how to install the MCP server for a client.
const ( // InstallMethodFile installs by writing to a config file. InstallMethodFile InstallMethod = iota // InstallMethodCLI installs using the client's CLI command. InstallMethodCLI )
type InstallOptions ¶ added in v2.11.2
type InstallOptions struct {
// WithCommitHook installs a PreToolUse hook that scans before Claude commits.
// Off by default: unlike a skill file, a hook is a shell command that runs on
// the user's machine, so it has to be asked for explicitly.
WithCommitHook bool
}
InstallOptions carries opt-in choices for an install.
type InstallationResult ¶
type InstallationResult struct {
// Success indicates whether the operation succeeded.
Success bool
// ClientName is the client that was configured.
ClientName string
// ConfigPath is the path to the config file modified (empty for CLI-based).
ConfigPath string
// Message contains success or error message.
Message string
// NeedsRestart indicates whether the client needs restart.
NeedsRestart bool
// SkillsPath is the directory skills were installed into, empty if none were.
SkillsPath string
// Skills lists the skill names installed or removed.
Skills []string
// SkillsSupported reports whether the client has a skills mechanism at all;
// false means the caller should say so rather than imply skills were set up.
SkillsSupported bool
// SkillsError is set when MCP configuration succeeded but skills did not.
// Skills are an enhancement, so this does not fail the install.
SkillsError error
// CommitHookRequested reports whether the caller asked for the commit hook.
CommitHookRequested bool
// CommitHookInstalled reports whether it was actually installed or removed.
CommitHookInstalled bool
// CommitHookScript is the path of the installed hook script.
CommitHookScript string
// CommitHookSettings is the settings file the hook was registered in.
CommitHookSettings string
// CommitHookBinary is the kusari executable the hook will invoke. Reported
// because the hook records whichever binary installed it, which may be a
// throwaway build rather than the installed one.
CommitHookBinary string
// CommitHookError is set when the hook could not be installed or removed.
CommitHookError error
}
InstallationResult contains the result of an install/uninstall operation.
func Install ¶
func Install(client ClientConfig) (*InstallationResult, error)
Install installs the Kusari MCP server for the given client.
func InstallWithOptions ¶ added in v2.11.2
func InstallWithOptions(client ClientConfig, opts InstallOptions) (*InstallationResult, error)
InstallWithOptions configures the MCP server plus any opted-in extras.
func Uninstall ¶
func Uninstall(client ClientConfig) (*InstallationResult, error)
Uninstall removes the Kusari MCP server from the given client.
type Platform ¶
type Platform string
Platform represents an operating system platform.
func GetPlatform ¶
func GetPlatform() Platform
GetPlatform returns the current operating system platform.