wave-agent-sdk 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.d.ts +92 -23
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +340 -137
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/managers/aiManager.d.ts +14 -36
- package/dist/managers/aiManager.d.ts.map +1 -1
- package/dist/managers/aiManager.js +74 -77
- package/dist/managers/backgroundBashManager.d.ts.map +1 -1
- package/dist/managers/backgroundBashManager.js +4 -3
- package/dist/managers/hookManager.d.ts +3 -8
- package/dist/managers/hookManager.d.ts.map +1 -1
- package/dist/managers/hookManager.js +39 -29
- package/dist/managers/liveConfigManager.d.ts +55 -18
- package/dist/managers/liveConfigManager.d.ts.map +1 -1
- package/dist/managers/liveConfigManager.js +372 -90
- package/dist/managers/lspManager.d.ts +43 -0
- package/dist/managers/lspManager.d.ts.map +1 -0
- package/dist/managers/lspManager.js +326 -0
- package/dist/managers/messageManager.d.ts +8 -16
- package/dist/managers/messageManager.d.ts.map +1 -1
- package/dist/managers/messageManager.js +52 -74
- package/dist/managers/permissionManager.d.ts +66 -0
- package/dist/managers/permissionManager.d.ts.map +1 -0
- package/dist/managers/permissionManager.js +208 -0
- package/dist/managers/skillManager.d.ts +1 -0
- package/dist/managers/skillManager.d.ts.map +1 -1
- package/dist/managers/skillManager.js +2 -1
- package/dist/managers/slashCommandManager.d.ts.map +1 -1
- package/dist/managers/slashCommandManager.js +0 -1
- package/dist/managers/subagentManager.d.ts +8 -23
- package/dist/managers/subagentManager.d.ts.map +1 -1
- package/dist/managers/subagentManager.js +97 -117
- package/dist/managers/toolManager.d.ts +38 -1
- package/dist/managers/toolManager.d.ts.map +1 -1
- package/dist/managers/toolManager.js +66 -2
- package/dist/services/aiService.d.ts +3 -1
- package/dist/services/aiService.d.ts.map +1 -1
- package/dist/services/aiService.js +123 -30
- package/dist/services/configurationService.d.ts +116 -0
- package/dist/services/configurationService.d.ts.map +1 -0
- package/dist/services/configurationService.js +585 -0
- package/dist/services/fileWatcher.d.ts.map +1 -1
- package/dist/services/fileWatcher.js +5 -6
- package/dist/services/hook.d.ts +7 -124
- package/dist/services/hook.d.ts.map +1 -1
- package/dist/services/hook.js +46 -458
- package/dist/services/jsonlHandler.d.ts +24 -15
- package/dist/services/jsonlHandler.d.ts.map +1 -1
- package/dist/services/jsonlHandler.js +67 -88
- package/dist/services/memory.d.ts +0 -9
- package/dist/services/memory.d.ts.map +1 -1
- package/dist/services/memory.js +2 -49
- package/dist/services/session.d.ts +82 -33
- package/dist/services/session.d.ts.map +1 -1
- package/dist/services/session.js +275 -181
- package/dist/tools/bashTool.d.ts.map +1 -1
- package/dist/tools/bashTool.js +72 -13
- package/dist/tools/deleteFileTool.d.ts.map +1 -1
- package/dist/tools/deleteFileTool.js +25 -0
- package/dist/tools/editTool.d.ts.map +1 -1
- package/dist/tools/editTool.js +30 -6
- package/dist/tools/lspTool.d.ts +6 -0
- package/dist/tools/lspTool.d.ts.map +1 -0
- package/dist/tools/lspTool.js +589 -0
- package/dist/tools/multiEditTool.d.ts.map +1 -1
- package/dist/tools/multiEditTool.js +26 -7
- package/dist/tools/readTool.d.ts.map +1 -1
- package/dist/tools/readTool.js +111 -2
- package/dist/tools/skillTool.js +2 -2
- package/dist/tools/todoWriteTool.d.ts.map +1 -1
- package/dist/tools/todoWriteTool.js +23 -0
- package/dist/tools/types.d.ts +11 -8
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/writeTool.d.ts.map +1 -1
- package/dist/tools/writeTool.js +25 -9
- package/dist/types/commands.d.ts +0 -1
- package/dist/types/commands.d.ts.map +1 -1
- package/dist/types/config.d.ts +4 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/configuration.d.ts +69 -0
- package/dist/types/configuration.d.ts.map +1 -0
- package/dist/types/configuration.js +8 -0
- package/dist/types/core.d.ts +10 -0
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/environment.d.ts +41 -0
- package/dist/types/environment.d.ts.map +1 -1
- package/dist/types/fileSearch.d.ts +5 -0
- package/dist/types/fileSearch.d.ts.map +1 -0
- package/dist/types/fileSearch.js +1 -0
- package/dist/types/hooks.d.ts +11 -2
- package/dist/types/hooks.d.ts.map +1 -1
- package/dist/types/hooks.js +1 -7
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +5 -0
- package/dist/types/lsp.d.ts +90 -0
- package/dist/types/lsp.d.ts.map +1 -0
- package/dist/types/lsp.js +4 -0
- package/dist/types/messaging.d.ts +6 -11
- package/dist/types/messaging.d.ts.map +1 -1
- package/dist/types/permissions.d.ts +35 -0
- package/dist/types/permissions.d.ts.map +1 -0
- package/dist/types/permissions.js +12 -0
- package/dist/types/session.d.ts +1 -6
- package/dist/types/session.d.ts.map +1 -1
- package/dist/types/skills.d.ts +1 -0
- package/dist/types/skills.d.ts.map +1 -1
- package/dist/types/tools.d.ts +35 -0
- package/dist/types/tools.d.ts.map +1 -0
- package/dist/types/tools.js +4 -0
- package/dist/utils/abortUtils.d.ts +34 -0
- package/dist/utils/abortUtils.d.ts.map +1 -0
- package/dist/utils/abortUtils.js +92 -0
- package/dist/utils/bashHistory.d.ts +4 -0
- package/dist/utils/bashHistory.d.ts.map +1 -1
- package/dist/utils/bashHistory.js +21 -4
- package/dist/utils/builtinSubagents.d.ts +7 -0
- package/dist/utils/builtinSubagents.d.ts.map +1 -0
- package/dist/utils/builtinSubagents.js +65 -0
- package/dist/utils/cacheControlUtils.d.ts +8 -33
- package/dist/utils/cacheControlUtils.d.ts.map +1 -1
- package/dist/utils/cacheControlUtils.js +83 -126
- package/dist/utils/constants.d.ts +0 -12
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +1 -13
- package/dist/utils/convertMessagesForAPI.d.ts +2 -1
- package/dist/utils/convertMessagesForAPI.d.ts.map +1 -1
- package/dist/utils/convertMessagesForAPI.js +33 -14
- package/dist/utils/fileSearch.d.ts +14 -0
- package/dist/utils/fileSearch.d.ts.map +1 -0
- package/dist/utils/fileSearch.js +88 -0
- package/dist/utils/fileUtils.d.ts +14 -2
- package/dist/utils/fileUtils.d.ts.map +1 -1
- package/dist/utils/fileUtils.js +101 -17
- package/dist/utils/globalLogger.d.ts +0 -14
- package/dist/utils/globalLogger.d.ts.map +1 -1
- package/dist/utils/globalLogger.js +0 -16
- package/dist/utils/largeOutputHandler.d.ts +15 -0
- package/dist/utils/largeOutputHandler.d.ts.map +1 -0
- package/dist/utils/largeOutputHandler.js +40 -0
- package/dist/utils/markdownParser.d.ts.map +1 -1
- package/dist/utils/markdownParser.js +1 -17
- package/dist/utils/messageOperations.d.ts +1 -11
- package/dist/utils/messageOperations.d.ts.map +1 -1
- package/dist/utils/messageOperations.js +7 -24
- package/dist/utils/pathEncoder.d.ts +4 -0
- package/dist/utils/pathEncoder.d.ts.map +1 -1
- package/dist/utils/pathEncoder.js +16 -9
- package/dist/utils/subagentParser.d.ts +2 -2
- package/dist/utils/subagentParser.d.ts.map +1 -1
- package/dist/utils/subagentParser.js +10 -7
- package/dist/utils/tokenEstimator.d.ts +39 -0
- package/dist/utils/tokenEstimator.d.ts.map +1 -0
- package/dist/utils/tokenEstimator.js +55 -0
- package/package.json +5 -8
- package/src/agent.ts +460 -216
- package/src/index.ts +2 -0
- package/src/managers/aiManager.ts +107 -111
- package/src/managers/backgroundBashManager.ts +4 -3
- package/src/managers/hookManager.ts +44 -39
- package/src/managers/liveConfigManager.ts +524 -138
- package/src/managers/lspManager.ts +434 -0
- package/src/managers/messageManager.ts +73 -103
- package/src/managers/permissionManager.ts +276 -0
- package/src/managers/skillManager.ts +3 -1
- package/src/managers/slashCommandManager.ts +1 -2
- package/src/managers/subagentManager.ts +116 -159
- package/src/managers/toolManager.ts +95 -3
- package/src/services/aiService.ts +207 -26
- package/src/services/configurationService.ts +762 -0
- package/src/services/fileWatcher.ts +5 -6
- package/src/services/hook.ts +50 -631
- package/src/services/jsonlHandler.ts +84 -100
- package/src/services/memory.ts +2 -59
- package/src/services/session.ts +338 -213
- package/src/tools/bashTool.ts +89 -16
- package/src/tools/deleteFileTool.ts +36 -0
- package/src/tools/editTool.ts +41 -7
- package/src/tools/lspTool.ts +760 -0
- package/src/tools/multiEditTool.ts +37 -8
- package/src/tools/readTool.ts +125 -2
- package/src/tools/skillTool.ts +2 -2
- package/src/tools/todoWriteTool.ts +33 -1
- package/src/tools/types.ts +15 -9
- package/src/tools/writeTool.ts +36 -10
- package/src/types/commands.ts +0 -1
- package/src/types/config.ts +5 -0
- package/src/types/configuration.ts +73 -0
- package/src/types/core.ts +11 -0
- package/src/types/environment.ts +44 -0
- package/src/types/fileSearch.ts +4 -0
- package/src/types/hooks.ts +14 -11
- package/src/types/index.ts +5 -0
- package/src/types/lsp.ts +96 -0
- package/src/types/messaging.ts +8 -13
- package/src/types/permissions.ts +48 -0
- package/src/types/session.ts +3 -8
- package/src/types/skills.ts +1 -0
- package/src/types/tools.ts +38 -0
- package/src/utils/abortUtils.ts +118 -0
- package/src/utils/bashHistory.ts +28 -4
- package/src/utils/builtinSubagents.ts +71 -0
- package/src/utils/cacheControlUtils.ts +106 -171
- package/src/utils/constants.ts +1 -16
- package/src/utils/convertMessagesForAPI.ts +38 -14
- package/src/utils/fileSearch.ts +107 -0
- package/src/utils/fileUtils.ts +114 -19
- package/src/utils/globalLogger.ts +0 -17
- package/src/utils/largeOutputHandler.ts +55 -0
- package/src/utils/markdownParser.ts +1 -19
- package/src/utils/messageOperations.ts +7 -35
- package/src/utils/pathEncoder.ts +24 -9
- package/src/utils/subagentParser.ts +11 -8
- package/src/utils/tokenEstimator.ts +68 -0
- package/dist/constants/events.d.ts +0 -28
- package/dist/constants/events.d.ts.map +0 -1
- package/dist/constants/events.js +0 -27
- package/dist/services/configurationWatcher.d.ts +0 -120
- package/dist/services/configurationWatcher.d.ts.map +0 -1
- package/dist/services/configurationWatcher.js +0 -439
- package/dist/services/memoryStore.d.ts +0 -81
- package/dist/services/memoryStore.d.ts.map +0 -1
- package/dist/services/memoryStore.js +0 -200
- package/dist/types/memoryStore.d.ts +0 -82
- package/dist/types/memoryStore.d.ts.map +0 -1
- package/dist/types/memoryStore.js +0 -7
- package/dist/utils/configResolver.d.ts +0 -65
- package/dist/utils/configResolver.d.ts.map +0 -1
- package/dist/utils/configResolver.js +0 -210
- package/src/constants/events.ts +0 -38
- package/src/services/configurationWatcher.ts +0 -622
- package/src/services/memoryStore.ts +0 -279
- package/src/types/memoryStore.ts +0 -94
- package/src/utils/configResolver.ts +0 -302
|
@@ -3,52 +3,89 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Orchestrates live configuration reload functionality including:
|
|
5
5
|
* - Hook configuration watching and reloading
|
|
6
|
-
* -
|
|
6
|
+
* - Configuration file watching for settings.json files
|
|
7
7
|
* - Coordination between file watchers and configuration updates
|
|
8
8
|
*/
|
|
9
9
|
import type { Logger } from "../types/index.js";
|
|
10
|
+
import type { HookManager } from "./hookManager.js";
|
|
11
|
+
import type { PermissionManager } from "./permissionManager.js";
|
|
12
|
+
import type { WaveConfiguration } from "../types/hooks.js";
|
|
13
|
+
import { ConfigurationService } from "../services/configurationService.js";
|
|
10
14
|
export interface LiveConfigManagerOptions {
|
|
11
15
|
workdir: string;
|
|
12
16
|
logger?: Logger;
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
hookManager?: HookManager;
|
|
18
|
+
permissionManager?: PermissionManager;
|
|
19
|
+
configurationService?: ConfigurationService;
|
|
15
20
|
}
|
|
16
21
|
export declare class LiveConfigManager {
|
|
17
22
|
private readonly workdir;
|
|
18
23
|
private readonly logger?;
|
|
19
|
-
private readonly
|
|
20
|
-
private readonly
|
|
21
|
-
private configurationWatcher?;
|
|
24
|
+
private readonly hookManager?;
|
|
25
|
+
private readonly permissionManager?;
|
|
22
26
|
private isInitialized;
|
|
27
|
+
private readonly configurationService;
|
|
28
|
+
private currentConfiguration;
|
|
29
|
+
private lastValidConfiguration;
|
|
30
|
+
private fileWatcher;
|
|
31
|
+
private userConfigPaths?;
|
|
32
|
+
private projectConfigPaths?;
|
|
33
|
+
private isWatching;
|
|
34
|
+
private reloadInProgress;
|
|
23
35
|
constructor(options: LiveConfigManagerOptions);
|
|
24
36
|
/**
|
|
25
|
-
* Initialize
|
|
37
|
+
* Initialize configuration watching
|
|
38
|
+
* Maps to FR-004: System MUST watch settings.json files
|
|
39
|
+
* Supports watching multiple file paths (e.g., settings.local.json and settings.json)
|
|
40
|
+
*/
|
|
41
|
+
private initializeWatching;
|
|
42
|
+
/**
|
|
43
|
+
* Get current configuration
|
|
44
|
+
*/
|
|
45
|
+
getCurrentConfiguration(): WaveConfiguration | null;
|
|
46
|
+
/**
|
|
47
|
+
* Initialize configuration management with file watching
|
|
26
48
|
*/
|
|
27
49
|
initialize(): Promise<void>;
|
|
28
50
|
/**
|
|
29
|
-
* Shutdown
|
|
51
|
+
* Shutdown configuration management and cleanup resources
|
|
30
52
|
*/
|
|
31
53
|
shutdown(): Promise<void>;
|
|
32
54
|
/**
|
|
33
|
-
*
|
|
55
|
+
* Reload configuration from files
|
|
56
|
+
* Maps to FR-008: Continue with previous valid configuration on errors
|
|
34
57
|
*/
|
|
35
|
-
private
|
|
58
|
+
private reloadConfiguration;
|
|
36
59
|
/**
|
|
37
|
-
*
|
|
60
|
+
* Reload configuration from files (public method)
|
|
38
61
|
*/
|
|
39
|
-
|
|
62
|
+
reload(): Promise<WaveConfiguration>;
|
|
40
63
|
/**
|
|
41
|
-
*
|
|
64
|
+
* Check if watching is active
|
|
42
65
|
*/
|
|
43
|
-
|
|
66
|
+
isWatchingActive(): boolean;
|
|
44
67
|
/**
|
|
45
|
-
*
|
|
68
|
+
* Get watcher status for monitoring
|
|
46
69
|
*/
|
|
47
|
-
|
|
70
|
+
getWatcherStatus(): {
|
|
71
|
+
isActive: boolean;
|
|
72
|
+
configurationLoaded: boolean;
|
|
73
|
+
hasValidConfiguration: boolean;
|
|
74
|
+
reloadInProgress: boolean;
|
|
75
|
+
watchedFiles: {
|
|
76
|
+
path: string;
|
|
77
|
+
isActive: boolean;
|
|
78
|
+
method: "native" | "polling" | "failed";
|
|
79
|
+
errorCount: number;
|
|
80
|
+
}[];
|
|
81
|
+
};
|
|
82
|
+
private setupFileWatcherEvents;
|
|
83
|
+
private handleFileChange;
|
|
48
84
|
/**
|
|
49
|
-
*
|
|
85
|
+
* Validate configuration structure and content
|
|
50
86
|
*/
|
|
51
|
-
|
|
87
|
+
private validateConfiguration;
|
|
88
|
+
private detectChanges;
|
|
52
89
|
/**
|
|
53
90
|
* Get configuration file paths for user and project settings
|
|
54
91
|
* Returns paths in priority order (local.json first, then .json)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liveConfigManager.d.ts","sourceRoot":"","sources":["../../src/managers/liveConfigManager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"liveConfigManager.d.ts","sourceRoot":"","sources":["../../src/managers/liveConfigManager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAKhD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAKhE,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,mBAAmB,CAAC;AAE7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAK3E,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;CAC7C;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAc;IAC3C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAoB;IACvD,OAAO,CAAC,aAAa,CAAkB;IACvC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAuB;IAG5D,OAAO,CAAC,oBAAoB,CAAkC;IAC9D,OAAO,CAAC,sBAAsB,CAAkC;IAGhE,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,eAAe,CAAC,CAAW;IACnC,OAAO,CAAC,kBAAkB,CAAC,CAAW;IACtC,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,gBAAgB,CAAkB;gBAE9B,OAAO,EAAE,wBAAwB;IAW7C;;;;OAIG;YACW,kBAAkB;IA6DhC;;OAEG;IACH,uBAAuB,IAAI,iBAAiB,GAAG,IAAI;IAInD;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAuBjC;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAyB/B;;;OAGG;YACW,mBAAmB;IA8MjC;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAK1C;;OAEG;IACH,gBAAgB,IAAI,OAAO;IAI3B;;OAEG;IACH,gBAAgB;;;;;;;;;;;;IAgBhB,OAAO,CAAC,sBAAsB;YAMhB,gBAAgB;IA8C9B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IA0E7B,OAAO,CAAC,aAAa;IAuDrB;;;OAGG;IACH,OAAO,CAAC,qBAAqB;CAQ9B"}
|
|
@@ -3,150 +3,432 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Orchestrates live configuration reload functionality including:
|
|
5
5
|
* - Hook configuration watching and reloading
|
|
6
|
-
* -
|
|
6
|
+
* - Configuration file watching for settings.json files
|
|
7
7
|
* - Coordination between file watchers and configuration updates
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
9
|
+
import { existsSync } from "fs";
|
|
10
|
+
import { FileWatcherService, } from "../services/fileWatcher.js";
|
|
11
|
+
import { getProjectConfigPaths, getUserConfigPaths, } from "../utils/configPaths.js";
|
|
12
|
+
import { isValidHookEvent, isValidHookEventConfig } from "../types/hooks.js";
|
|
13
|
+
import { ConfigurationService } from "../services/configurationService.js";
|
|
14
|
+
import { ensureGlobalGitIgnore } from "../utils/fileUtils.js";
|
|
14
15
|
export class LiveConfigManager {
|
|
15
16
|
constructor(options) {
|
|
16
17
|
this.isInitialized = false;
|
|
18
|
+
// Configuration state
|
|
19
|
+
this.currentConfiguration = null;
|
|
20
|
+
this.lastValidConfiguration = null;
|
|
21
|
+
this.isWatching = false;
|
|
22
|
+
this.reloadInProgress = false;
|
|
17
23
|
this.workdir = options.workdir;
|
|
18
24
|
this.logger = options.logger;
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
25
|
+
this.hookManager = options.hookManager;
|
|
26
|
+
this.permissionManager = options.permissionManager;
|
|
27
|
+
this.configurationService =
|
|
28
|
+
options.configurationService || new ConfigurationService();
|
|
29
|
+
this.fileWatcher = new FileWatcherService(this.logger);
|
|
30
|
+
this.setupFileWatcherEvents();
|
|
21
31
|
}
|
|
22
32
|
/**
|
|
23
|
-
* Initialize
|
|
33
|
+
* Initialize configuration watching
|
|
34
|
+
* Maps to FR-004: System MUST watch settings.json files
|
|
35
|
+
* Supports watching multiple file paths (e.g., settings.local.json and settings.json)
|
|
36
|
+
*/
|
|
37
|
+
async initializeWatching(userPaths, projectPaths) {
|
|
38
|
+
try {
|
|
39
|
+
this.logger?.info("Live Config: Initializing configuration watching...");
|
|
40
|
+
this.userConfigPaths = userPaths;
|
|
41
|
+
this.projectConfigPaths = projectPaths;
|
|
42
|
+
// Load initial configuration
|
|
43
|
+
await this.reloadConfiguration();
|
|
44
|
+
// Start watching user configs that exist
|
|
45
|
+
for (const userPath of userPaths) {
|
|
46
|
+
if (existsSync(userPath)) {
|
|
47
|
+
this.logger?.debug(`Live Config: Starting to watch user config: ${userPath}`);
|
|
48
|
+
await this.fileWatcher.watchFile(userPath, (event) => this.handleFileChange(event, "user"));
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
this.logger?.debug(`Live Config: User config file does not exist: ${userPath}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Start watching project configs that exist
|
|
55
|
+
if (projectPaths) {
|
|
56
|
+
for (const projectPath of projectPaths) {
|
|
57
|
+
if (existsSync(projectPath)) {
|
|
58
|
+
if (projectPath.endsWith("settings.local.json")) {
|
|
59
|
+
await ensureGlobalGitIgnore("**/.wave/settings.local.json");
|
|
60
|
+
}
|
|
61
|
+
this.logger?.debug(`Live Config: Starting to watch project config: ${projectPath}`);
|
|
62
|
+
await this.fileWatcher.watchFile(projectPath, (event) => this.handleFileChange(event, "project"));
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
this.logger?.debug(`Live Config: Project config file does not exist: ${projectPath}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
this.isWatching = true;
|
|
70
|
+
this.logger?.info("Live Config: Configuration watching initialized successfully");
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
const errorMessage = `Failed to initialize configuration watching: ${error.message}`;
|
|
74
|
+
this.logger?.error(`Live Config: ${errorMessage}`);
|
|
75
|
+
throw new Error(errorMessage);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Get current configuration
|
|
80
|
+
*/
|
|
81
|
+
getCurrentConfiguration() {
|
|
82
|
+
return this.currentConfiguration ? { ...this.currentConfiguration } : null;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Initialize configuration management with file watching
|
|
24
86
|
*/
|
|
25
87
|
async initialize() {
|
|
26
88
|
if (this.isInitialized) {
|
|
27
|
-
this.logger?.debug("
|
|
89
|
+
this.logger?.debug("Already initialized");
|
|
28
90
|
return;
|
|
29
91
|
}
|
|
30
92
|
try {
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
// Initialize
|
|
34
|
-
|
|
35
|
-
await this.initializeMemoryStoreWatching();
|
|
36
|
-
}
|
|
93
|
+
// Get configuration file paths
|
|
94
|
+
const { userPaths, projectPaths } = this.getConfigurationPaths();
|
|
95
|
+
// Initialize configuration watching
|
|
96
|
+
await this.initializeWatching(userPaths, projectPaths);
|
|
37
97
|
this.isInitialized = true;
|
|
38
|
-
this.logger?.info("Live
|
|
98
|
+
this.logger?.info("Live configuration management initialized with file watching");
|
|
39
99
|
}
|
|
40
100
|
catch (error) {
|
|
41
|
-
this.logger?.error(`
|
|
101
|
+
this.logger?.error(`Failed to initialize: ${error.message}`);
|
|
42
102
|
throw error;
|
|
43
103
|
}
|
|
44
104
|
}
|
|
45
105
|
/**
|
|
46
|
-
* Shutdown
|
|
106
|
+
* Shutdown configuration management and cleanup resources
|
|
47
107
|
*/
|
|
48
108
|
async shutdown() {
|
|
49
109
|
if (!this.isInitialized) {
|
|
50
110
|
return;
|
|
51
111
|
}
|
|
52
112
|
try {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
113
|
+
this.logger?.info("Live Config: Shutting down configuration manager...");
|
|
114
|
+
this.isWatching = false;
|
|
115
|
+
// Cleanup file watcher
|
|
116
|
+
await this.fileWatcher.cleanup();
|
|
117
|
+
// Clean up state
|
|
118
|
+
this.currentConfiguration = null;
|
|
119
|
+
this.lastValidConfiguration = null;
|
|
57
120
|
this.isInitialized = false;
|
|
58
|
-
this.logger?.info("Live
|
|
121
|
+
this.logger?.info("Live configuration management shutdown completed");
|
|
59
122
|
}
|
|
60
123
|
catch (error) {
|
|
61
|
-
this.logger?.error(`
|
|
124
|
+
this.logger?.error(`Error during shutdown: ${error.message}`);
|
|
62
125
|
throw error;
|
|
63
126
|
}
|
|
64
127
|
}
|
|
65
128
|
/**
|
|
66
|
-
*
|
|
67
|
-
|
|
68
|
-
async initializeConfigurationWatcher() {
|
|
69
|
-
this.configurationWatcher = new ConfigurationWatcher(this.workdir, this.logger);
|
|
70
|
-
// Set up configuration change handler using EventEmitter pattern
|
|
71
|
-
this.configurationWatcher.on(CONFIGURATION_EVENTS.CONFIGURATION_CHANGE, (event) => {
|
|
72
|
-
this.handleConfigurationChange(event);
|
|
73
|
-
});
|
|
74
|
-
// Initialize watching for user and project settings
|
|
75
|
-
const { userPaths, projectPaths } = this.getConfigurationPaths();
|
|
76
|
-
await this.configurationWatcher.initializeWatching(userPaths, projectPaths);
|
|
77
|
-
this.logger?.info("Live Config: Configuration watching initialized");
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Initialize memory store watching for AGENTS.md files
|
|
129
|
+
* Reload configuration from files
|
|
130
|
+
* Maps to FR-008: Continue with previous valid configuration on errors
|
|
81
131
|
*/
|
|
82
|
-
async
|
|
83
|
-
if (
|
|
84
|
-
this.logger?.debug("Live Config:
|
|
85
|
-
return;
|
|
132
|
+
async reloadConfiguration() {
|
|
133
|
+
if (this.reloadInProgress) {
|
|
134
|
+
this.logger?.debug("Live Config: Reload already in progress, skipping");
|
|
135
|
+
return this.currentConfiguration || {};
|
|
86
136
|
}
|
|
137
|
+
this.reloadInProgress = true;
|
|
87
138
|
try {
|
|
88
|
-
|
|
89
|
-
//
|
|
90
|
-
await this.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
139
|
+
this.logger?.debug("Live Config: Reloading configuration from files...");
|
|
140
|
+
// Load merged configuration using ConfigurationService
|
|
141
|
+
const loadResult = await this.configurationService.loadMergedConfiguration(this.workdir);
|
|
142
|
+
const newConfig = loadResult.configuration;
|
|
143
|
+
// Check for errors during loading
|
|
144
|
+
if (!loadResult.success) {
|
|
145
|
+
const errorMessage = loadResult.error || "Configuration loading failed with unknown error";
|
|
146
|
+
this.logger?.error(`Live Config: Configuration loading failed: ${errorMessage}`);
|
|
147
|
+
// Log warnings if any
|
|
148
|
+
if (loadResult.warnings && loadResult.warnings.length > 0) {
|
|
149
|
+
this.logger?.warn(`Live Config: Configuration warnings: ${loadResult.warnings.join("; ")}`);
|
|
150
|
+
}
|
|
151
|
+
// Use fallback configuration if available
|
|
152
|
+
if (this.lastValidConfiguration) {
|
|
153
|
+
this.logger?.info("Live Config: Using previous valid configuration due to loading errors");
|
|
154
|
+
this.currentConfiguration = this.lastValidConfiguration;
|
|
155
|
+
// Apply environment variables to configuration service if configured
|
|
156
|
+
if (this.lastValidConfiguration.env) {
|
|
157
|
+
this.configurationService.setEnvironmentVars(this.lastValidConfiguration.env);
|
|
158
|
+
}
|
|
159
|
+
// Update hook manager if available
|
|
160
|
+
if (this.hookManager) {
|
|
161
|
+
this.hookManager.loadConfigurationFromWaveConfig(this.lastValidConfiguration);
|
|
162
|
+
}
|
|
163
|
+
return this.currentConfiguration;
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
this.logger?.warn("Live Config: No previous valid configuration available, using empty config");
|
|
167
|
+
this.currentConfiguration = {};
|
|
168
|
+
return this.currentConfiguration;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// Log success with detailed information
|
|
172
|
+
if (newConfig) {
|
|
173
|
+
this.logger?.info(`Live Config: Configuration loaded successfully from ${loadResult.sourcePath || "merged sources"}`);
|
|
174
|
+
// Log detailed configuration info
|
|
175
|
+
const hookCount = Object.keys(newConfig.hooks || {}).length;
|
|
176
|
+
const envCount = Object.keys(newConfig.env || {}).length;
|
|
177
|
+
this.logger?.debug(`Live Config: Loaded ${hookCount} hook events and ${envCount} environment variables`);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
this.logger?.info("Live Config: No configuration found (using empty configuration)");
|
|
181
|
+
}
|
|
182
|
+
// Log warnings from successful loading
|
|
183
|
+
if (loadResult.warnings && loadResult.warnings.length > 0) {
|
|
184
|
+
this.logger?.warn(`Live Config: Configuration warnings: ${loadResult.warnings.join("; ")}`);
|
|
185
|
+
}
|
|
186
|
+
// Validate new configuration if it exists
|
|
187
|
+
if (newConfig) {
|
|
188
|
+
const validation = this.validateConfiguration(newConfig);
|
|
189
|
+
if (!validation.valid) {
|
|
190
|
+
const errorMessage = `Configuration validation failed: ${validation.errors.join(", ")}`;
|
|
191
|
+
this.logger?.error(`Live Config: ${errorMessage}`);
|
|
192
|
+
// Use previous valid configuration for error recovery
|
|
193
|
+
if (this.lastValidConfiguration) {
|
|
194
|
+
this.logger?.info("Live Config: Using previous valid configuration due to validation errors");
|
|
195
|
+
this.currentConfiguration = this.lastValidConfiguration;
|
|
196
|
+
// Apply environment variables to configuration service if configured
|
|
197
|
+
if (this.lastValidConfiguration.env) {
|
|
198
|
+
this.configurationService.setEnvironmentVars(this.lastValidConfiguration.env);
|
|
199
|
+
}
|
|
200
|
+
// Update hook manager if available
|
|
201
|
+
if (this.hookManager) {
|
|
202
|
+
this.hookManager.loadConfigurationFromWaveConfig(this.lastValidConfiguration);
|
|
203
|
+
}
|
|
204
|
+
return this.currentConfiguration;
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
this.logger?.warn("Live Config: No previous valid configuration available, using empty config");
|
|
208
|
+
this.currentConfiguration = {};
|
|
209
|
+
return this.currentConfiguration;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// Detect changes between old and new configuration
|
|
214
|
+
this.detectChanges(this.currentConfiguration, newConfig);
|
|
215
|
+
// Update current configuration
|
|
216
|
+
this.currentConfiguration = newConfig || {};
|
|
217
|
+
// Save as last valid configuration if it's valid and not empty
|
|
218
|
+
if (newConfig && (newConfig.hooks || newConfig.env)) {
|
|
219
|
+
this.lastValidConfiguration = { ...newConfig };
|
|
220
|
+
this.logger?.debug("Live Config: Saved current configuration as last valid backup");
|
|
221
|
+
}
|
|
222
|
+
// Note: Environment variables are already applied by loadMergedConfiguration()
|
|
223
|
+
// No need to set them again here as currentConfiguration === newConfig
|
|
224
|
+
// Update hook manager if available
|
|
225
|
+
if (this.hookManager) {
|
|
226
|
+
this.hookManager.loadConfigurationFromWaveConfig(this.currentConfiguration);
|
|
227
|
+
}
|
|
228
|
+
// Update permission manager if available
|
|
229
|
+
if (this.permissionManager) {
|
|
230
|
+
if (this.currentConfiguration.defaultMode) {
|
|
231
|
+
this.permissionManager.updateConfiguredDefaultMode(this.currentConfiguration.defaultMode);
|
|
232
|
+
}
|
|
233
|
+
if (this.currentConfiguration.permissions?.allow) {
|
|
234
|
+
this.permissionManager.updateAllowedRules(this.currentConfiguration.permissions.allow);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
this.logger?.info(`Live Config: Configuration reload completed successfully with ${Object.keys(newConfig?.hooks || {}).length} event types and ${Object.keys(newConfig?.env || {}).length} environment variables`);
|
|
238
|
+
return this.currentConfiguration;
|
|
94
239
|
}
|
|
95
240
|
catch (error) {
|
|
96
|
-
|
|
97
|
-
|
|
241
|
+
const errorMessage = `Configuration reload failed with exception: ${error.message}`;
|
|
242
|
+
this.logger?.error(`Live Config: ${errorMessage}`);
|
|
243
|
+
// Use previous valid configuration for error recovery
|
|
244
|
+
if (this.lastValidConfiguration) {
|
|
245
|
+
this.logger?.info("Live Config: Using previous valid configuration due to reload exception");
|
|
246
|
+
this.currentConfiguration = this.lastValidConfiguration;
|
|
247
|
+
// Apply environment variables to configuration service if configured
|
|
248
|
+
if (this.lastValidConfiguration.env) {
|
|
249
|
+
this.configurationService.setEnvironmentVars(this.lastValidConfiguration.env);
|
|
250
|
+
}
|
|
251
|
+
// Update hook manager if available
|
|
252
|
+
if (this.hookManager) {
|
|
253
|
+
this.hookManager.loadConfigurationFromWaveConfig(this.lastValidConfiguration);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
this.logger?.warn("Live Config: No previous valid configuration available, using empty config");
|
|
258
|
+
this.currentConfiguration = {};
|
|
259
|
+
}
|
|
260
|
+
return this.currentConfiguration;
|
|
261
|
+
}
|
|
262
|
+
finally {
|
|
263
|
+
this.reloadInProgress = false;
|
|
98
264
|
}
|
|
99
265
|
}
|
|
100
266
|
/**
|
|
101
|
-
*
|
|
267
|
+
* Reload configuration from files (public method)
|
|
102
268
|
*/
|
|
103
|
-
|
|
104
|
-
this.logger?.info(
|
|
105
|
-
|
|
106
|
-
configResolver.invalidateCache(this.workdir);
|
|
107
|
-
configResolver.refreshCache(this.workdir);
|
|
108
|
-
// Trigger Agent configuration update callback if provided
|
|
109
|
-
if (this.onConfigurationChanged) {
|
|
110
|
-
try {
|
|
111
|
-
this.logger?.info("Live Config: Triggering Agent configuration update");
|
|
112
|
-
this.onConfigurationChanged();
|
|
113
|
-
}
|
|
114
|
-
catch (error) {
|
|
115
|
-
this.logger?.error(`Live Config: Error in configuration change callback: ${error.message}`);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
// Log cache status after refresh
|
|
119
|
-
const cacheStatus = configResolver.getCacheStatus();
|
|
120
|
-
if (cacheStatus) {
|
|
121
|
-
this.logger?.info(`Live Config: Configuration cache refreshed - ${cacheStatus.envVarCount} environment variables loaded`);
|
|
122
|
-
}
|
|
269
|
+
async reload() {
|
|
270
|
+
this.logger?.info("Manually reloading configuration...");
|
|
271
|
+
return await this.reloadConfiguration();
|
|
123
272
|
}
|
|
124
273
|
/**
|
|
125
|
-
*
|
|
274
|
+
* Check if watching is active
|
|
126
275
|
*/
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
276
|
+
isWatchingActive() {
|
|
277
|
+
return this.isWatching;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Get watcher status for monitoring
|
|
281
|
+
*/
|
|
282
|
+
getWatcherStatus() {
|
|
283
|
+
const statuses = this.fileWatcher.getAllWatcherStatuses();
|
|
284
|
+
return {
|
|
285
|
+
isActive: this.isWatching,
|
|
286
|
+
configurationLoaded: this.currentConfiguration !== null,
|
|
287
|
+
hasValidConfiguration: this.lastValidConfiguration !== null,
|
|
288
|
+
reloadInProgress: this.reloadInProgress,
|
|
289
|
+
watchedFiles: statuses.map((s) => ({
|
|
290
|
+
path: s.path,
|
|
291
|
+
isActive: s.isActive,
|
|
292
|
+
method: s.method,
|
|
293
|
+
errorCount: s.errorCount,
|
|
294
|
+
})),
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
setupFileWatcherEvents() {
|
|
298
|
+
this.fileWatcher.on("watcherError", (error) => {
|
|
299
|
+
this.logger?.error(`Live Config: File watcher error: ${error.message}`);
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
async handleFileChange(event, source) {
|
|
303
|
+
this.logger?.debug(`Live Config: File ${event.type} detected for ${source} config: ${event.path}`);
|
|
131
304
|
try {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
305
|
+
// Handle file deletion
|
|
306
|
+
if (event.type === "delete") {
|
|
307
|
+
this.logger?.info(`Live Config: ${source} config file deleted: ${event.path}`);
|
|
308
|
+
// Reload configuration without the deleted file
|
|
309
|
+
await this.reloadConfiguration();
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
// Handle file creation or modification
|
|
313
|
+
if (event.type === "change" || event.type === "create") {
|
|
314
|
+
this.logger?.info(`Live Config: ${source} config file ${event.type}: ${event.path}`);
|
|
315
|
+
if (source === "project" &&
|
|
316
|
+
event.path.endsWith("settings.local.json") &&
|
|
317
|
+
event.type === "create") {
|
|
318
|
+
await ensureGlobalGitIgnore("**/.wave/settings.local.json");
|
|
319
|
+
}
|
|
320
|
+
// Add small delay to ensure file write is complete
|
|
321
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
322
|
+
// Reload configuration
|
|
323
|
+
await this.reloadConfiguration();
|
|
324
|
+
}
|
|
140
325
|
}
|
|
141
326
|
catch (error) {
|
|
142
|
-
this.logger?.error(`Live Config:
|
|
327
|
+
this.logger?.error(`Live Config: Error handling file change for ${source} config: ${error.message}`);
|
|
143
328
|
}
|
|
144
329
|
}
|
|
145
330
|
/**
|
|
146
|
-
*
|
|
331
|
+
* Validate configuration structure and content
|
|
147
332
|
*/
|
|
148
|
-
|
|
149
|
-
|
|
333
|
+
validateConfiguration(config) {
|
|
334
|
+
const errors = [];
|
|
335
|
+
if (!config || typeof config !== "object") {
|
|
336
|
+
return { valid: false, errors: ["Configuration must be an object"] };
|
|
337
|
+
}
|
|
338
|
+
// Validate defaultMode if present
|
|
339
|
+
if (config.defaultMode !== undefined) {
|
|
340
|
+
if (config.defaultMode !== "default" &&
|
|
341
|
+
config.defaultMode !== "bypassPermissions" &&
|
|
342
|
+
config.defaultMode !== "acceptEdits") {
|
|
343
|
+
errors.push(`Invalid defaultMode: "${config.defaultMode}". Must be "default", "bypassPermissions" or "acceptEdits"`);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
// Validate hooks if present
|
|
347
|
+
if (config.hooks) {
|
|
348
|
+
if (typeof config.hooks !== "object") {
|
|
349
|
+
errors.push("hooks property must be an object");
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
// Validate each hook event
|
|
353
|
+
for (const [eventName, eventConfigs] of Object.entries(config.hooks)) {
|
|
354
|
+
// Validate event name
|
|
355
|
+
if (!isValidHookEvent(eventName)) {
|
|
356
|
+
errors.push(`Invalid hook event: ${eventName}`);
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
// Validate event configurations
|
|
360
|
+
if (!Array.isArray(eventConfigs)) {
|
|
361
|
+
errors.push(`Hook event ${eventName} must be an array of configurations`);
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
364
|
+
eventConfigs.forEach((eventConfig, index) => {
|
|
365
|
+
if (!isValidHookEventConfig(eventConfig)) {
|
|
366
|
+
errors.push(`Invalid hook event configuration at ${eventName}[${index}]`);
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
// Validate environment variables if present
|
|
373
|
+
if (config.env) {
|
|
374
|
+
if (typeof config.env !== "object" || Array.isArray(config.env)) {
|
|
375
|
+
errors.push("env property must be an object");
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
for (const [key, value] of Object.entries(config.env)) {
|
|
379
|
+
if (typeof key !== "string" || key.trim() === "") {
|
|
380
|
+
errors.push(`Invalid environment variable key: ${key}`);
|
|
381
|
+
}
|
|
382
|
+
if (typeof value !== "string") {
|
|
383
|
+
errors.push(`Environment variable ${key} must have a string value`);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
return {
|
|
389
|
+
valid: errors.length === 0,
|
|
390
|
+
errors,
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
detectChanges(oldConfig, newConfig) {
|
|
394
|
+
const added = [];
|
|
395
|
+
const modified = [];
|
|
396
|
+
const removed = [];
|
|
397
|
+
// Handle environment variables changes
|
|
398
|
+
const oldEnv = oldConfig?.env || {};
|
|
399
|
+
const newEnv = newConfig?.env || {};
|
|
400
|
+
for (const key of Object.keys(newEnv)) {
|
|
401
|
+
if (!(key in oldEnv)) {
|
|
402
|
+
added.push(`env.${key}`);
|
|
403
|
+
}
|
|
404
|
+
else if (oldEnv[key] !== newEnv[key]) {
|
|
405
|
+
modified.push(`env.${key}`);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
for (const key of Object.keys(oldEnv)) {
|
|
409
|
+
if (!(key in newEnv)) {
|
|
410
|
+
removed.push(`env.${key}`);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
// Handle hooks changes (simplified)
|
|
414
|
+
const oldHooks = oldConfig?.hooks || {};
|
|
415
|
+
const newHooks = newConfig?.hooks || {};
|
|
416
|
+
for (const event of Object.keys(newHooks)) {
|
|
417
|
+
if (isValidHookEvent(event)) {
|
|
418
|
+
if (!(event in oldHooks)) {
|
|
419
|
+
added.push(`hooks.${event}`);
|
|
420
|
+
}
|
|
421
|
+
else if (JSON.stringify(oldHooks[event]) !== JSON.stringify(newHooks[event])) {
|
|
422
|
+
modified.push(`hooks.${event}`);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
for (const event of Object.keys(oldHooks)) {
|
|
427
|
+
if (isValidHookEvent(event) && !(event in newHooks)) {
|
|
428
|
+
removed.push(`hooks.${event}`);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
return { added, modified, removed };
|
|
150
432
|
}
|
|
151
433
|
/**
|
|
152
434
|
* Get configuration file paths for user and project settings
|