mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-30 06:12:03 +00:00
feat: implement server logging and event hook features
- Introduced server log level configuration and HTTP request logging settings, allowing users to control the verbosity of server logs and enable or disable request logging at runtime. - Added an Event Hook Service to execute custom actions based on system events, supporting shell commands and HTTP webhooks. - Enhanced the UI with new sections for managing server logging preferences and event hooks, including a dialog for creating and editing hooks. - Updated global settings to include server log level and request logging options, ensuring persistence across sessions. These changes aim to improve debugging capabilities and provide users with customizable event-driven actions within the application.
This commit is contained in:
@@ -128,6 +128,7 @@ export type {
|
||||
ThemeMode,
|
||||
PlanningMode,
|
||||
ThinkingLevel,
|
||||
ServerLogLevel,
|
||||
ModelProvider,
|
||||
PhaseModelEntry,
|
||||
PhaseModelConfig,
|
||||
@@ -143,6 +144,13 @@ export type {
|
||||
BoardBackgroundSettings,
|
||||
WorktreeInfo,
|
||||
ProjectSettings,
|
||||
// Event hook types
|
||||
EventHookTrigger,
|
||||
EventHookHttpMethod,
|
||||
EventHookShellAction,
|
||||
EventHookHttpAction,
|
||||
EventHookAction,
|
||||
EventHook,
|
||||
} from './settings.js';
|
||||
export {
|
||||
DEFAULT_KEYBOARD_SHORTCUTS,
|
||||
@@ -155,6 +163,8 @@ export {
|
||||
PROJECT_SETTINGS_VERSION,
|
||||
THINKING_TOKEN_BUDGET,
|
||||
getThinkingTokenBudget,
|
||||
// Event hook constants
|
||||
EVENT_HOOK_TRIGGER_LABELS,
|
||||
} from './settings.js';
|
||||
|
||||
// Model display constants
|
||||
|
||||
@@ -68,6 +68,9 @@ export type ThemeMode =
|
||||
/** PlanningMode - Planning levels for feature generation workflows */
|
||||
export type PlanningMode = 'skip' | 'lite' | 'spec' | 'full';
|
||||
|
||||
/** ServerLogLevel - Log verbosity level for the API server */
|
||||
export type ServerLogLevel = 'error' | 'warn' | 'info' | 'debug';
|
||||
|
||||
/** ThinkingLevel - Extended thinking levels for Claude models (reasoning intensity) */
|
||||
export type ThinkingLevel = 'none' | 'low' | 'medium' | 'high' | 'ultrathink';
|
||||
|
||||
@@ -98,6 +101,97 @@ export function getThinkingTokenBudget(level: ThinkingLevel | undefined): number
|
||||
/** ModelProvider - AI model provider for credentials and API key management */
|
||||
export type ModelProvider = 'claude' | 'cursor' | 'codex' | 'opencode';
|
||||
|
||||
// ============================================================================
|
||||
// Event Hooks - Custom actions triggered by system events
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* EventHookTrigger - Event types that can trigger custom hooks
|
||||
*
|
||||
* - feature_success: Feature completed successfully
|
||||
* - feature_error: Feature failed with an error
|
||||
* - auto_mode_complete: Auto mode finished processing all features
|
||||
* - auto_mode_error: Auto mode encountered a critical error and paused
|
||||
*/
|
||||
export type EventHookTrigger =
|
||||
| 'feature_success'
|
||||
| 'feature_error'
|
||||
| 'auto_mode_complete'
|
||||
| 'auto_mode_error';
|
||||
|
||||
/** HTTP methods supported for webhook requests */
|
||||
export type EventHookHttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH';
|
||||
|
||||
/**
|
||||
* EventHookShellAction - Configuration for executing a shell command
|
||||
*
|
||||
* Shell commands are executed in the server's working directory.
|
||||
* Supports variable substitution using {{variableName}} syntax.
|
||||
*/
|
||||
export interface EventHookShellAction {
|
||||
type: 'shell';
|
||||
/** Shell command to execute. Supports {{variable}} substitution. */
|
||||
command: string;
|
||||
/** Timeout in milliseconds (default: 30000) */
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* EventHookHttpAction - Configuration for making an HTTP webhook request
|
||||
*
|
||||
* Supports variable substitution in URL, headers, and body.
|
||||
*/
|
||||
export interface EventHookHttpAction {
|
||||
type: 'http';
|
||||
/** URL to send the request to. Supports {{variable}} substitution. */
|
||||
url: string;
|
||||
/** HTTP method to use */
|
||||
method: EventHookHttpMethod;
|
||||
/** Optional headers to include. Values support {{variable}} substitution. */
|
||||
headers?: Record<string, string>;
|
||||
/** Optional request body (JSON string). Supports {{variable}} substitution. */
|
||||
body?: string;
|
||||
}
|
||||
|
||||
/** Union type for all hook action configurations */
|
||||
export type EventHookAction = EventHookShellAction | EventHookHttpAction;
|
||||
|
||||
/**
|
||||
* EventHook - Configuration for a single event hook
|
||||
*
|
||||
* Event hooks allow users to execute custom shell commands or HTTP requests
|
||||
* when specific events occur in the system.
|
||||
*
|
||||
* Available variables for substitution:
|
||||
* - {{featureId}} - ID of the feature (if applicable)
|
||||
* - {{featureName}} - Name of the feature (if applicable)
|
||||
* - {{projectPath}} - Absolute path to the project
|
||||
* - {{projectName}} - Name of the project
|
||||
* - {{error}} - Error message (for error events)
|
||||
* - {{timestamp}} - ISO timestamp of the event
|
||||
* - {{eventType}} - The event type that triggered the hook
|
||||
*/
|
||||
export interface EventHook {
|
||||
/** Unique identifier for this hook */
|
||||
id: string;
|
||||
/** Which event type triggers this hook */
|
||||
trigger: EventHookTrigger;
|
||||
/** Whether this hook is currently enabled */
|
||||
enabled: boolean;
|
||||
/** The action to execute when triggered */
|
||||
action: EventHookAction;
|
||||
/** Optional friendly name for display */
|
||||
name?: string;
|
||||
}
|
||||
|
||||
/** Human-readable labels for event hook triggers */
|
||||
export const EVENT_HOOK_TRIGGER_LABELS: Record<EventHookTrigger, string> = {
|
||||
feature_success: 'Feature completed successfully',
|
||||
feature_error: 'Feature failed with error',
|
||||
auto_mode_complete: 'Auto mode completed all features',
|
||||
auto_mode_error: 'Auto mode paused due to error',
|
||||
};
|
||||
|
||||
const DEFAULT_CODEX_AUTO_LOAD_AGENTS = false;
|
||||
const DEFAULT_CODEX_SANDBOX_MODE: CodexSandboxMode = 'workspace-write';
|
||||
const DEFAULT_CODEX_APPROVAL_POLICY: CodexApprovalPolicy = 'on-request';
|
||||
@@ -390,6 +484,12 @@ export interface GlobalSettings {
|
||||
/** Mute completion notification sound */
|
||||
muteDoneSound: boolean;
|
||||
|
||||
// Server Logging Preferences
|
||||
/** Log level for the API server (error, warn, info, debug). Default: info */
|
||||
serverLogLevel?: ServerLogLevel;
|
||||
/** Enable HTTP request logging (Morgan). Default: true */
|
||||
enableRequestLogging?: boolean;
|
||||
|
||||
// AI Commit Message Generation
|
||||
/** Enable AI-generated commit messages when opening commit dialog (default: true) */
|
||||
enableAiCommitMessages: boolean;
|
||||
@@ -524,6 +624,13 @@ export interface GlobalSettings {
|
||||
* Value: agent configuration
|
||||
*/
|
||||
customSubagents?: Record<string, import('./provider.js').AgentDefinition>;
|
||||
|
||||
// Event Hooks Configuration
|
||||
/**
|
||||
* Event hooks for executing custom commands or HTTP requests on events
|
||||
* @see EventHook for configuration details
|
||||
*/
|
||||
eventHooks?: EventHook[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -725,6 +832,8 @@ export const DEFAULT_GLOBAL_SETTINGS: GlobalSettings = {
|
||||
defaultRequirePlanApproval: false,
|
||||
defaultFeatureModel: { model: 'opus' },
|
||||
muteDoneSound: false,
|
||||
serverLogLevel: 'info',
|
||||
enableRequestLogging: true,
|
||||
enableAiCommitMessages: true,
|
||||
phaseModels: DEFAULT_PHASE_MODELS,
|
||||
enhancementModel: 'sonnet',
|
||||
|
||||
Reference in New Issue
Block a user