Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions .claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"hooks": [
{
"type": "command",
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks claude-code post-task'"
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks claude-code post-task'",
"timeout": 120
}
]
},
Expand All @@ -27,7 +28,8 @@
"hooks": [
{
"type": "command",
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks claude-code post-task'"
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks claude-code post-task'",
"timeout": 120
}
]
}
Expand All @@ -38,7 +40,8 @@
"hooks": [
{
"type": "command",
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks claude-code pre-task'"
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks claude-code pre-task'",
"timeout": 30
}
]
}
Expand All @@ -64,7 +67,8 @@
},
{
"type": "command",
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then printf \"%s\\n\" \"{\\\"systemMessage\\\":\\\"\\\\n\\\\nEntire CLI is enabled but not installed or not on PATH.\\\\nInstallation guide: https://docs.entire.io/cli/installation#installation-methods\\\"}\"; exit 0; fi; exec entire hooks claude-code session-start'"
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then printf \"%s\\n\" \"{\\\"systemMessage\\\":\\\"\\\\n\\\\nEntire CLI is enabled but not installed or not on PATH.\\\\nInstallation guide: https://docs.entire.io/cli/installation#installation-methods\\\"}\"; exit 0; fi; exec entire hooks claude-code session-start'",
"timeout": 30
}
]
}
Expand All @@ -75,7 +79,8 @@
"hooks": [
{
"type": "command",
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks claude-code stop'"
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks claude-code stop'",
"timeout": 120
}
]
}
Expand All @@ -86,7 +91,8 @@
"hooks": [
{
"type": "command",
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks claude-code stop-failure'"
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks claude-code stop-failure'",
"timeout": 120
}
]
}
Expand All @@ -97,7 +103,8 @@
"hooks": [
{
"type": "command",
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks claude-code subagent-start'"
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks claude-code subagent-start'",
"timeout": 30
}
]
}
Expand All @@ -108,7 +115,8 @@
"hooks": [
{
"type": "command",
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks claude-code subagent-stop'"
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks claude-code subagent-stop'",
"timeout": 120
}
]
}
Expand All @@ -119,7 +127,8 @@
"hooks": [
{
"type": "command",
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks claude-code user-prompt-submit'"
"command": "sh -c 'if ! command -v entire >/dev/null 2>&1; then exit 0; fi; exec entire hooks claude-code user-prompt-submit'",
"timeout": 30
}
]
}
Expand Down
22 changes: 18 additions & 4 deletions cmd/entire/cli/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,32 @@ type HookFreshness interface {
}

// StaleHookReporter is implemented by hook-supporting agents whose install
// also prunes Entire hooks that older CLIs wrote and this one no longer does
// (for Claude Code, the retired post-todo hook). `entire enable` asks before
// installing, so it can say it removed them instead of reporting the hooks as
// also rewrites Entire hooks that older CLIs wrote: pruning ones this CLI no
// longer writes (for Claude Code, the retired post-todo hook) or updating ones
// whose shape changed (Claude Code's hook timeouts). `entire enable` asks before
// installing, so it can say it updated them instead of reporting the hooks as
// already installed. Implementations must be read-only.
type StaleHookReporter interface {
Agent

// HasStaleManagedHooks reports whether the agent's hook config holds
// Entire hooks the next install will remove.
// Entire hooks the next install will remove or update.
HasStaleManagedHooks(ctx context.Context) bool
}

// HookTimeoutRepairer is implemented by agents whose Entire hooks carry
// timeouts that configs written by older CLIs lack. `entire doctor` runs the
// repair without asking, because a user who already enabled Entire has no
// reason to run enable again. The repair must only give Entire's own hooks a
// missing timeout and leave everything the user chose as it is.
type HookTimeoutRepairer interface {
Agent

// RepairHookTimeouts adds the missing timeouts and reports whether it
// rewrote the hook config. An absent config is not an error.
RepairHookTimeouts(ctx context.Context) (bool, error)
}

// EffectiveHookDiagnostics marks agents whose effective hook state is reported
// by an agent-owned diagnostic surface rather than generic freshness output.
type EffectiveHookDiagnostics interface {
Expand Down
7 changes: 7 additions & 0 deletions cmd/entire/cli/agent/capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type CapabilityDeclarer interface {
// - HomeScopedInventoryExtractor
// - HookConfigLocator
// - HookFreshness
// - HookTimeoutRepairer
// - InventoryAwareExtractor
// - LateTranscriptWriter (refuses CapabilityDeclarer agents)
// - ModelExtractor
Expand Down Expand Up @@ -131,6 +132,12 @@ func AsStaleHookReporter(ag Agent) (StaleHookReporter, bool) {
return builtinCapability[StaleHookReporter](ag)
}

// AsHookTimeoutRepairer returns the agent as HookTimeoutRepairer if it can
// add the hook timeouts an older CLI wrote its config without.
func AsHookTimeoutRepairer(ag Agent) (HookTimeoutRepairer, bool) {
return builtinCapability[HookTimeoutRepairer](ag)
}

// AsEffectiveHookDiagnostics returns the agent as EffectiveHookDiagnostics if
// it owns diagnostics for its effective hook configuration.
func AsEffectiveHookDiagnostics(ag Agent) (EffectiveHookDiagnostics, bool) {
Expand Down
Loading
Loading