maskweaver 0.9.3 → 0.9.5
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/README.ko.md +279 -325
- package/README.md +109 -113
- package/assets/commands/meta/commands.json +34 -34
- package/assets/commands/weave-agents.md +12 -52
- package/assets/commands/weave-approve.md +12 -51
- package/assets/commands/weave-archive.md +21 -0
- package/assets/commands/weave-build.md +20 -89
- package/assets/commands/weave-craft.md +22 -43
- package/assets/commands/weave-help.md +37 -106
- package/assets/commands/weave-init.md +26 -108
- package/assets/commands/weave-interview.md +13 -111
- package/assets/commands/weave-map.md +13 -99
- package/assets/commands/weave-prepare.md +23 -69
- package/assets/commands/weave-refine-plan.md +26 -59
- package/assets/commands/weave-repair.md +22 -70
- package/assets/commands/weave-status.md +22 -155
- package/assets/commands/weave-troubleshoot.md +11 -47
- package/assets/commands/weave-verify.md +23 -44
- package/assets/commands/weave-worktree.md +27 -69
- package/dist/cli/doctor.js +5 -21
- package/dist/cli/install.d.ts +0 -8
- package/dist/cli/install.js +0 -39
- package/dist/context/config.d.ts +0 -22
- package/dist/context/config.js +0 -28
- package/dist/context/feature.d.ts +0 -39
- package/dist/context/feature.js +0 -77
- package/dist/context/files.d.ts +0 -13
- package/dist/context/files.js +1 -24
- package/dist/context/index.d.ts +0 -7
- package/dist/context/index.js +0 -12
- package/dist/context/project.d.ts +0 -21
- package/dist/context/project.js +0 -30
- package/dist/context/types.d.ts +0 -48
- package/dist/context/types.js +0 -12
- package/dist/context/utils.d.ts +0 -18
- package/dist/context/utils.js +0 -27
- package/dist/core/engine/promptBuilder.d.ts +0 -17
- package/dist/core/engine/promptBuilder.js +0 -28
- package/dist/core/index.d.ts +0 -6
- package/dist/core/index.js +0 -9
- package/dist/core/loader/MaskLoader.d.ts +0 -23
- package/dist/core/loader/MaskLoader.js +0 -29
- package/dist/core/schema/types.d.ts +0 -47
- package/dist/core/schema/types.js +0 -6
- package/dist/core/schema/validator.d.ts +0 -14
- package/dist/core/schema/validator.js +0 -18
- package/dist/i18n/index.d.ts +0 -18
- package/dist/i18n/index.js +4 -23
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -8
- package/dist/lib.d.ts +0 -5
- package/dist/lib.js +0 -12
- package/dist/memory/chunking.d.ts +0 -22
- package/dist/memory/chunking.js +2 -37
- package/dist/memory/core.d.ts +0 -29
- package/dist/memory/core.js +1 -52
- package/dist/memory/index.d.ts +0 -5
- package/dist/memory/index.js +0 -10
- package/dist/memory/indexer.d.ts +0 -21
- package/dist/memory/indexer.js +0 -44
- package/dist/memory/providers/examples.d.ts +0 -5
- package/dist/memory/providers/examples.js +4 -64
- package/dist/memory/providers/factory.d.ts +0 -44
- package/dist/memory/providers/factory.js +0 -46
- package/dist/memory/providers/index.d.ts +0 -26
- package/dist/memory/providers/index.js +0 -28
- package/dist/memory/providers/ollama.d.ts +0 -6
- package/dist/memory/providers/ollama.js +1 -8
- package/dist/memory/providers/openai.d.ts +0 -6
- package/dist/memory/providers/openai.js +1 -8
- package/dist/memory/providers/openrouter.d.ts +0 -6
- package/dist/memory/providers/openrouter.js +0 -8
- package/dist/memory/providers/text-only.d.ts +0 -13
- package/dist/memory/providers/text-only.js +0 -17
- package/dist/memory/providers/types.d.ts +0 -39
- package/dist/memory/providers/types.js +0 -7
- package/dist/memory/providers/voyage.d.ts +0 -22
- package/dist/memory/providers/voyage.js +1 -24
- package/dist/memory/search/hybrid.d.ts +0 -12
- package/dist/memory/search/hybrid.js +1 -22
- package/dist/memory/store/sqlite.d.ts +0 -72
- package/dist/memory/store/sqlite.js +4 -127
- package/dist/plugin/config/index.d.ts +0 -112
- package/dist/plugin/config/index.js +0 -115
- package/dist/plugin/index.d.ts +0 -13
- package/dist/plugin/index.js +1 -124
- package/dist/plugin/tools/command-registry.d.ts +0 -6
- package/dist/plugin/tools/command-registry.js +0 -14
- package/dist/plugin/tools/context.d.ts +0 -12
- package/dist/plugin/tools/context.js +0 -58
- package/dist/plugin/tools/maskSave.d.ts +0 -3
- package/dist/plugin/tools/maskSave.js +0 -3
- package/dist/plugin/tools/memoryGet.d.ts +0 -3
- package/dist/plugin/tools/memoryGet.js +0 -3
- package/dist/plugin/tools/memoryIndexer.d.ts +0 -3
- package/dist/plugin/tools/memoryIndexer.js +0 -10
- package/dist/plugin/tools/memorySearch.d.ts +0 -31
- package/dist/plugin/tools/memorySearch.js +0 -79
- package/dist/plugin/tools/memoryWrite.d.ts +0 -8
- package/dist/plugin/tools/memoryWrite.js +0 -32
- package/dist/plugin/tools/retrospect.d.ts +0 -3
- package/dist/plugin/tools/retrospect.js +0 -3
- package/dist/plugin/tools/slashcommand.d.ts +0 -11
- package/dist/plugin/tools/slashcommand.js +0 -38
- package/dist/plugin/tools/squad.d.ts +0 -12
- package/dist/plugin/tools/squad.js +11 -83
- package/dist/plugin/tools/weave.d.ts +0 -6
- package/dist/plugin/tools/weave.js +0 -78
- package/dist/plugin/types.d.ts +0 -20
- package/dist/plugin/types.js +0 -7
- package/dist/retrospect/index.d.ts +0 -7
- package/dist/retrospect/index.js +0 -9
- package/dist/retrospect/mask-save.d.ts +0 -12
- package/dist/retrospect/mask-save.js +1 -80
- package/dist/retrospect/retrospect.d.ts +0 -18
- package/dist/retrospect/retrospect.js +0 -63
- package/dist/retrospect/strategies/base.d.ts +0 -15
- package/dist/retrospect/strategies/base.js +0 -7
- package/dist/retrospect/strategies/deep.d.ts +0 -12
- package/dist/retrospect/strategies/deep.js +0 -24
- package/dist/retrospect/strategies/index.d.ts +0 -12
- package/dist/retrospect/strategies/index.js +0 -12
- package/dist/retrospect/strategies/quick.d.ts +0 -12
- package/dist/retrospect/strategies/quick.js +0 -19
- package/dist/retrospect/strategies/standard.d.ts +0 -12
- package/dist/retrospect/strategies/standard.js +0 -15
- package/dist/retrospect/types.d.ts +0 -7
- package/dist/retrospect/types.js +0 -7
- package/dist/shared/config.d.ts +0 -105
- package/dist/shared/config.js +0 -33
- package/dist/shared/errors.d.ts +0 -18
- package/dist/shared/errors.js +0 -19
- package/dist/shared/generate-agents.d.ts +0 -69
- package/dist/shared/generate-agents.js +2 -86
- package/dist/shared/image.d.ts +0 -67
- package/dist/shared/image.js +6 -104
- package/dist/shared/index.d.ts +0 -5
- package/dist/shared/index.js +0 -7
- package/dist/shared/model-registry.d.ts +0 -72
- package/dist/shared/model-registry.js +5 -95
- package/dist/shared/types.d.ts +0 -15
- package/dist/shared/types.js +0 -3
- package/dist/shared-context/dag.d.ts +0 -105
- package/dist/shared-context/dag.js +3 -114
- package/dist/shared-context/index.d.ts +0 -5
- package/dist/shared-context/index.js +0 -15
- package/dist/shared-context/logger.d.ts +0 -37
- package/dist/shared-context/logger.js +0 -41
- package/dist/shared-context/parallel-executor.d.ts +0 -54
- package/dist/shared-context/parallel-executor.js +4 -56
- package/dist/shared-context/session.d.ts +0 -56
- package/dist/shared-context/session.js +0 -47
- package/dist/shared-context/squad.d.ts +0 -68
- package/dist/shared-context/squad.js +0 -63
- package/dist/shared-context/storage.d.ts +0 -132
- package/dist/shared-context/storage.js +0 -116
- package/dist/shared-context/task.d.ts +0 -120
- package/dist/shared-context/task.js +0 -152
- package/dist/shared-context/test/dag.test.js +9 -14
- package/dist/shared-context/test/logger.test.d.ts +0 -8
- package/dist/shared-context/test/logger.test.js +0 -52
- package/dist/shared-context/test/session.test.d.ts +0 -7
- package/dist/shared-context/test/session.test.js +0 -63
- package/dist/shared-context/test/squad.test.d.ts +0 -10
- package/dist/shared-context/test/squad.test.js +2 -68
- package/dist/shared-context/test/storage.test.d.ts +0 -8
- package/dist/shared-context/test/storage.test.js +0 -68
- package/dist/shared-context/test/task.test.d.ts +0 -7
- package/dist/shared-context/test/task.test.js +0 -54
- package/dist/shared-context/test/watchdog.test.d.ts +0 -7
- package/dist/shared-context/test/watchdog.test.js +3 -58
- package/dist/shared-context/types.d.ts +0 -215
- package/dist/shared-context/types.js +0 -125
- package/dist/shared-context/watchdog.d.ts +0 -127
- package/dist/shared-context/watchdog.js +0 -148
- package/dist/shared-context/worktree.d.ts +0 -68
- package/dist/shared-context/worktree.js +2 -34
- package/dist/verify/budget.d.ts +0 -29
- package/dist/verify/budget.js +0 -34
- package/dist/verify/critical-files.d.ts +0 -17
- package/dist/verify/critical-files.js +0 -37
- package/dist/verify/escalation.d.ts +0 -20
- package/dist/verify/escalation.js +0 -22
- package/dist/verify/index.d.ts +0 -5
- package/dist/verify/index.js +0 -11
- package/dist/verify/prompts.d.ts +0 -20
- package/dist/verify/prompts.js +0 -20
- package/dist/verify/types.d.ts +0 -26
- package/dist/verify/types.js +1 -12
- package/dist/verify/verifier.d.ts +0 -29
- package/dist/verify/verifier.js +0 -54
- package/dist/version.d.ts +1 -16
- package/dist/version.js +1 -16
- package/dist/weave/bridge.d.ts +0 -35
- package/dist/weave/bridge.js +0 -51
- package/dist/weave/environment/detector.d.ts +0 -6
- package/dist/weave/environment/detector.js +4 -45
- package/dist/weave/environment/index.d.ts +0 -19
- package/dist/weave/environment/index.js +1 -39
- package/dist/weave/environment/issues.d.ts +0 -35
- package/dist/weave/environment/issues.js +0 -59
- package/dist/weave/git.d.ts +0 -8
- package/dist/weave/git.js +0 -8
- package/dist/weave/index.d.ts +0 -13
- package/dist/weave/index.js +2 -28
- package/dist/weave/knowledge/global.d.ts +0 -39
- package/dist/weave/knowledge/global.js +2 -78
- package/dist/weave/loop.js +0 -3
- package/dist/weave/orchestrator.d.ts +0 -69
- package/dist/weave/orchestrator.js +1 -101
- package/dist/weave/phase-manager.d.ts +0 -64
- package/dist/weave/phase-manager.js +0 -89
- package/dist/weave/security/secret-scan.d.ts +0 -14
- package/dist/weave/security/secret-scan.js +0 -19
- package/dist/weave/stages/build.js +0 -15
- package/dist/weave/stages/execute.d.ts +0 -42
- package/dist/weave/stages/execute.js +4 -86
- package/dist/weave/stages/handoff.d.ts +0 -7
- package/dist/weave/stages/handoff.js +0 -43
- package/dist/weave/stages/index.d.ts +0 -3
- package/dist/weave/stages/index.js +0 -3
- package/dist/weave/stages/intake.d.ts +0 -8
- package/dist/weave/stages/intake.js +5 -65
- package/dist/weave/stages/map.d.ts +0 -1
- package/dist/weave/stages/openspec.d.ts +0 -1
- package/dist/weave/stages/plan.d.ts +0 -11
- package/dist/weave/stages/plan.js +1 -53
- package/dist/weave/stages/refine.d.ts +0 -7
- package/dist/weave/stages/refine.js +0 -7
- package/dist/weave/stages/research.d.ts +0 -6
- package/dist/weave/stages/research.js +0 -6
- package/dist/weave/stages/spec.d.ts +0 -12
- package/dist/weave/stages/spec.js +0 -17
- package/dist/weave/types.d.ts +0 -20
- package/dist/weave/types.js +0 -5
- package/dist/weave/verification/commands.d.ts +0 -12
- package/dist/weave/verification/commands.js +0 -19
- package/dist/weave/verification/index.d.ts +0 -6
- package/dist/weave/verification/index.js +1 -19
- package/dist/weave/verification/playwright.d.ts +0 -47
- package/dist/weave/verification/playwright.js +1 -90
- package/dist/weave/worktree.d.ts +0 -16
- package/dist/weave/worktree.js +0 -23
- package/dist/weave/yaml-repair.d.ts +0 -39
- package/dist/weave/yaml-repair.js +13 -116
- package/package.json +1 -1
|
@@ -1,153 +1,41 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Maskweaver Plugin Configuration Loader
|
|
3
|
-
*
|
|
4
|
-
* Loads maskweaver.json(c) configuration files with support for:
|
|
5
|
-
* - Project-level configuration (.opencode/maskweaver.json)
|
|
6
|
-
* - Global configuration (~/.config/opencode/maskweaver.json)
|
|
7
|
-
* - JSONC format (comments, trailing commas)
|
|
8
|
-
*
|
|
9
|
-
* Based on oh-my-opencode pattern for plugin configuration management.
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Logger interface for config loading.
|
|
13
|
-
* Accepts the SDK client (or any compatible object).
|
|
14
|
-
*/
|
|
15
1
|
interface ConfigLoaderContext {
|
|
16
2
|
client: unknown;
|
|
17
3
|
verbose?: boolean;
|
|
18
4
|
}
|
|
19
|
-
/**
|
|
20
|
-
* Agent override configuration
|
|
21
|
-
*/
|
|
22
5
|
export interface AgentOverride {
|
|
23
6
|
model?: string;
|
|
24
7
|
systemPrompt?: string;
|
|
25
8
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Mask-specific configuration
|
|
28
|
-
*/
|
|
29
9
|
export interface MaskConfig {
|
|
30
|
-
/** Default mask ID to activate on session start */
|
|
31
10
|
default?: string;
|
|
32
|
-
/** Automatically activate default mask on session start */
|
|
33
11
|
autoActivate?: boolean;
|
|
34
12
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Logging configuration
|
|
37
|
-
*/
|
|
38
13
|
export interface LoggingConfig {
|
|
39
|
-
/** Enable verbose logging */
|
|
40
14
|
verbose?: boolean;
|
|
41
15
|
}
|
|
42
|
-
/**
|
|
43
|
-
* Completion sound notification configuration
|
|
44
|
-
*/
|
|
45
16
|
export interface CompletionSoundConfig {
|
|
46
|
-
/** Play sound when the active session becomes idle */
|
|
47
17
|
enabled?: boolean;
|
|
48
18
|
}
|
|
49
|
-
/**
|
|
50
|
-
* Notification configuration
|
|
51
|
-
*/
|
|
52
19
|
export interface NotificationsConfig {
|
|
53
20
|
completionSound?: CompletionSoundConfig;
|
|
54
21
|
}
|
|
55
|
-
/**
|
|
56
|
-
* Maskweaver Plugin Configuration
|
|
57
|
-
*/
|
|
58
22
|
export interface MaskweaverPluginConfig {
|
|
59
|
-
/** JSON Schema reference (for IDE support) */
|
|
60
23
|
$schema?: string;
|
|
61
|
-
/** List of disabled mask IDs */
|
|
62
24
|
disabled_masks?: string[];
|
|
63
|
-
/** List of disabled tool names */
|
|
64
25
|
disabled_tools?: string[];
|
|
65
|
-
/** Agent overrides (model, system prompt) */
|
|
66
26
|
agents?: Record<string, AgentOverride>;
|
|
67
|
-
/** Mask configuration */
|
|
68
27
|
masks?: MaskConfig;
|
|
69
|
-
/** Logging configuration */
|
|
70
28
|
logging?: LoggingConfig;
|
|
71
|
-
/** Notifications configuration */
|
|
72
29
|
notifications?: NotificationsConfig;
|
|
73
30
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Load plugin configuration from directory
|
|
76
|
-
*
|
|
77
|
-
* Searches for configuration files in priority order and returns
|
|
78
|
-
* the first found configuration. Returns empty object if no config found.
|
|
79
|
-
*
|
|
80
|
-
* @param directory - Project directory to search for config
|
|
81
|
-
* @param ctx - Optional plugin context (for logging)
|
|
82
|
-
* @returns Parsed configuration object
|
|
83
|
-
*/
|
|
84
31
|
export declare function loadPluginConfig(directory: string, ctx?: ConfigLoaderContext): MaskweaverPluginConfig;
|
|
85
|
-
/**
|
|
86
|
-
* Check if a tool is enabled in the configuration
|
|
87
|
-
*
|
|
88
|
-
* A tool is considered enabled if:
|
|
89
|
-
* - No disabled_tools list exists, OR
|
|
90
|
-
* - disabled_tools list exists but doesn't include the tool name
|
|
91
|
-
*
|
|
92
|
-
* @param config - Plugin configuration
|
|
93
|
-
* @param toolName - Name of the tool to check
|
|
94
|
-
* @returns true if tool is enabled, false otherwise
|
|
95
|
-
*/
|
|
96
32
|
export declare function isToolEnabled(config: MaskweaverPluginConfig, toolName: string): boolean;
|
|
97
|
-
/**
|
|
98
|
-
* Check if a mask is enabled in the configuration
|
|
99
|
-
*
|
|
100
|
-
* A mask is considered enabled if:
|
|
101
|
-
* - No disabled_masks list exists, OR
|
|
102
|
-
* - disabled_masks list exists but doesn't include the mask ID
|
|
103
|
-
*
|
|
104
|
-
* @param config - Plugin configuration
|
|
105
|
-
* @param maskId - ID of the mask to check
|
|
106
|
-
* @returns true if mask is enabled, false otherwise
|
|
107
|
-
*/
|
|
108
33
|
export declare function isMaskEnabled(config: MaskweaverPluginConfig, maskId: string): boolean;
|
|
109
|
-
/**
|
|
110
|
-
* Get the default mask ID from configuration
|
|
111
|
-
*
|
|
112
|
-
* @param config - Plugin configuration
|
|
113
|
-
* @returns Default mask ID if configured, undefined otherwise
|
|
114
|
-
*/
|
|
115
34
|
export declare function getDefaultMask(config: MaskweaverPluginConfig): string | undefined;
|
|
116
|
-
/**
|
|
117
|
-
* Check if auto-activation is enabled for the default mask
|
|
118
|
-
*
|
|
119
|
-
* @param config - Plugin configuration
|
|
120
|
-
* @returns true if auto-activation is enabled, false otherwise
|
|
121
|
-
*/
|
|
122
35
|
export declare function isAutoActivateEnabled(config: MaskweaverPluginConfig): boolean;
|
|
123
|
-
/**
|
|
124
|
-
* Get agent override for a specific agent
|
|
125
|
-
*
|
|
126
|
-
* @param config - Plugin configuration
|
|
127
|
-
* @param agentName - Name of the agent
|
|
128
|
-
* @returns Agent override config if exists, undefined otherwise
|
|
129
|
-
*/
|
|
130
36
|
export declare function getAgentOverride(config: MaskweaverPluginConfig, agentName: string): AgentOverride | undefined;
|
|
131
|
-
/**
|
|
132
|
-
* Check if verbose logging is enabled
|
|
133
|
-
*
|
|
134
|
-
* @param config - Plugin configuration
|
|
135
|
-
* @returns true if verbose logging is enabled, false otherwise
|
|
136
|
-
*/
|
|
137
37
|
export declare function isVerboseLoggingEnabled(config: MaskweaverPluginConfig): boolean;
|
|
138
|
-
/**
|
|
139
|
-
* Check if completion sound notification is enabled
|
|
140
|
-
*
|
|
141
|
-
* @param config - Plugin configuration
|
|
142
|
-
* @returns true if completion sound is enabled, false otherwise
|
|
143
|
-
*/
|
|
144
38
|
export declare function isCompletionSoundEnabled(config: MaskweaverPluginConfig): boolean;
|
|
145
|
-
/**
|
|
146
|
-
* Validate configuration structure
|
|
147
|
-
*
|
|
148
|
-
* @param config - Configuration to validate
|
|
149
|
-
* @returns Array of validation error messages (empty if valid)
|
|
150
|
-
*/
|
|
151
39
|
export declare function validateConfig(config: MaskweaverPluginConfig): string[];
|
|
152
40
|
declare const _default: {
|
|
153
41
|
loadPluginConfig: typeof loadPluginConfig;
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Maskweaver Plugin Configuration Loader
|
|
3
|
-
*
|
|
4
|
-
* Loads maskweaver.json(c) configuration files with support for:
|
|
5
|
-
* - Project-level configuration (.opencode/maskweaver.json)
|
|
6
|
-
* - Global configuration (~/.config/opencode/maskweaver.json)
|
|
7
|
-
* - JSONC format (comments, trailing commas)
|
|
8
|
-
*
|
|
9
|
-
* Based on oh-my-opencode pattern for plugin configuration management.
|
|
10
|
-
*/
|
|
11
1
|
import { parse as parseJsonc } from 'jsonc-parser';
|
|
12
2
|
import * as fs from 'node:fs';
|
|
13
3
|
import * as path from 'node:path';
|
|
@@ -21,51 +11,23 @@ function pluginLog(ctx, level, message) {
|
|
|
21
11
|
},
|
|
22
12
|
});
|
|
23
13
|
}
|
|
24
|
-
// ============================================================================
|
|
25
|
-
// Configuration Loader
|
|
26
|
-
// ============================================================================
|
|
27
|
-
/**
|
|
28
|
-
* Get all possible configuration file locations in priority order
|
|
29
|
-
*
|
|
30
|
-
* Priority:
|
|
31
|
-
* 1. .opencode/maskweaver.json (project)
|
|
32
|
-
* 2. .opencode/maskweaver.jsonc (project)
|
|
33
|
-
* 3. ~/.config/opencode/maskweaver.json (global)
|
|
34
|
-
* 4. ~/.config/opencode/maskweaver.jsonc (global)
|
|
35
|
-
*/
|
|
36
14
|
function getConfigLocations(directory) {
|
|
37
15
|
const homeDir = os.homedir();
|
|
38
16
|
return [
|
|
39
|
-
// Project-level configurations (highest priority)
|
|
40
17
|
path.join(directory, '.opencode', 'maskweaver.json'),
|
|
41
18
|
path.join(directory, '.opencode', 'maskweaver.jsonc'),
|
|
42
|
-
// Global configurations
|
|
43
19
|
path.join(homeDir, '.config', 'opencode', 'maskweaver.json'),
|
|
44
20
|
path.join(homeDir, '.config', 'opencode', 'maskweaver.jsonc'),
|
|
45
21
|
];
|
|
46
22
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Parse JSONC content (JSON with comments and trailing commas)
|
|
49
|
-
*/
|
|
50
23
|
function parseJsoncContent(content) {
|
|
51
24
|
try {
|
|
52
|
-
// Use jsonc-parser for robust JSONC parsing
|
|
53
25
|
return parseJsonc(content);
|
|
54
26
|
}
|
|
55
27
|
catch (error) {
|
|
56
28
|
throw new Error(`Failed to parse JSONC: ${error}`);
|
|
57
29
|
}
|
|
58
30
|
}
|
|
59
|
-
/**
|
|
60
|
-
* Load plugin configuration from directory
|
|
61
|
-
*
|
|
62
|
-
* Searches for configuration files in priority order and returns
|
|
63
|
-
* the first found configuration. Returns empty object if no config found.
|
|
64
|
-
*
|
|
65
|
-
* @param directory - Project directory to search for config
|
|
66
|
-
* @param ctx - Optional plugin context (for logging)
|
|
67
|
-
* @returns Parsed configuration object
|
|
68
|
-
*/
|
|
69
31
|
export function loadPluginConfig(directory, ctx) {
|
|
70
32
|
const locations = getConfigLocations(directory);
|
|
71
33
|
for (const location of locations) {
|
|
@@ -73,133 +35,61 @@ export function loadPluginConfig(directory, ctx) {
|
|
|
73
35
|
try {
|
|
74
36
|
const content = fs.readFileSync(location, 'utf-8');
|
|
75
37
|
const config = parseJsoncContent(content);
|
|
76
|
-
// Log successful config load
|
|
77
38
|
if (ctx?.verbose) {
|
|
78
39
|
pluginLog(ctx, 'info', `Loaded config from: ${location}`);
|
|
79
40
|
}
|
|
80
41
|
return config;
|
|
81
42
|
}
|
|
82
43
|
catch (error) {
|
|
83
|
-
// Log error but continue searching
|
|
84
44
|
if (ctx) {
|
|
85
45
|
pluginLog(ctx, 'warn', `Failed to load config from ${location}: ${error}`);
|
|
86
46
|
}
|
|
87
47
|
}
|
|
88
48
|
}
|
|
89
49
|
}
|
|
90
|
-
// No configuration found - return empty config
|
|
91
50
|
if (ctx?.verbose) {
|
|
92
51
|
pluginLog(ctx, 'info', 'No maskweaver.json found, using defaults');
|
|
93
52
|
}
|
|
94
53
|
return {};
|
|
95
54
|
}
|
|
96
|
-
// ============================================================================
|
|
97
|
-
// Helper Functions
|
|
98
|
-
// ============================================================================
|
|
99
|
-
/**
|
|
100
|
-
* Check if a tool is enabled in the configuration
|
|
101
|
-
*
|
|
102
|
-
* A tool is considered enabled if:
|
|
103
|
-
* - No disabled_tools list exists, OR
|
|
104
|
-
* - disabled_tools list exists but doesn't include the tool name
|
|
105
|
-
*
|
|
106
|
-
* @param config - Plugin configuration
|
|
107
|
-
* @param toolName - Name of the tool to check
|
|
108
|
-
* @returns true if tool is enabled, false otherwise
|
|
109
|
-
*/
|
|
110
55
|
export function isToolEnabled(config, toolName) {
|
|
111
56
|
if (!config.disabled_tools || config.disabled_tools.length === 0) {
|
|
112
57
|
return true;
|
|
113
58
|
}
|
|
114
59
|
return !config.disabled_tools.includes(toolName);
|
|
115
60
|
}
|
|
116
|
-
/**
|
|
117
|
-
* Check if a mask is enabled in the configuration
|
|
118
|
-
*
|
|
119
|
-
* A mask is considered enabled if:
|
|
120
|
-
* - No disabled_masks list exists, OR
|
|
121
|
-
* - disabled_masks list exists but doesn't include the mask ID
|
|
122
|
-
*
|
|
123
|
-
* @param config - Plugin configuration
|
|
124
|
-
* @param maskId - ID of the mask to check
|
|
125
|
-
* @returns true if mask is enabled, false otherwise
|
|
126
|
-
*/
|
|
127
61
|
export function isMaskEnabled(config, maskId) {
|
|
128
62
|
if (!config.disabled_masks || config.disabled_masks.length === 0) {
|
|
129
63
|
return true;
|
|
130
64
|
}
|
|
131
65
|
return !config.disabled_masks.includes(maskId);
|
|
132
66
|
}
|
|
133
|
-
/**
|
|
134
|
-
* Get the default mask ID from configuration
|
|
135
|
-
*
|
|
136
|
-
* @param config - Plugin configuration
|
|
137
|
-
* @returns Default mask ID if configured, undefined otherwise
|
|
138
|
-
*/
|
|
139
67
|
export function getDefaultMask(config) {
|
|
140
68
|
return config.masks?.default;
|
|
141
69
|
}
|
|
142
|
-
/**
|
|
143
|
-
* Check if auto-activation is enabled for the default mask
|
|
144
|
-
*
|
|
145
|
-
* @param config - Plugin configuration
|
|
146
|
-
* @returns true if auto-activation is enabled, false otherwise
|
|
147
|
-
*/
|
|
148
70
|
export function isAutoActivateEnabled(config) {
|
|
149
71
|
return config.masks?.autoActivate ?? false;
|
|
150
72
|
}
|
|
151
|
-
/**
|
|
152
|
-
* Get agent override for a specific agent
|
|
153
|
-
*
|
|
154
|
-
* @param config - Plugin configuration
|
|
155
|
-
* @param agentName - Name of the agent
|
|
156
|
-
* @returns Agent override config if exists, undefined otherwise
|
|
157
|
-
*/
|
|
158
73
|
export function getAgentOverride(config, agentName) {
|
|
159
74
|
return config.agents?.[agentName];
|
|
160
75
|
}
|
|
161
|
-
/**
|
|
162
|
-
* Check if verbose logging is enabled
|
|
163
|
-
*
|
|
164
|
-
* @param config - Plugin configuration
|
|
165
|
-
* @returns true if verbose logging is enabled, false otherwise
|
|
166
|
-
*/
|
|
167
76
|
export function isVerboseLoggingEnabled(config) {
|
|
168
77
|
return config.logging?.verbose ?? false;
|
|
169
78
|
}
|
|
170
|
-
/**
|
|
171
|
-
* Check if completion sound notification is enabled
|
|
172
|
-
*
|
|
173
|
-
* @param config - Plugin configuration
|
|
174
|
-
* @returns true if completion sound is enabled, false otherwise
|
|
175
|
-
*/
|
|
176
79
|
export function isCompletionSoundEnabled(config) {
|
|
177
80
|
return config.notifications?.completionSound?.enabled ?? false;
|
|
178
81
|
}
|
|
179
|
-
// ============================================================================
|
|
180
|
-
// Configuration Validation
|
|
181
|
-
// ============================================================================
|
|
182
|
-
/**
|
|
183
|
-
* Validate configuration structure
|
|
184
|
-
*
|
|
185
|
-
* @param config - Configuration to validate
|
|
186
|
-
* @returns Array of validation error messages (empty if valid)
|
|
187
|
-
*/
|
|
188
82
|
export function validateConfig(config) {
|
|
189
83
|
const errors = [];
|
|
190
|
-
// Validate disabled_masks
|
|
191
84
|
if (config.disabled_masks && !Array.isArray(config.disabled_masks)) {
|
|
192
85
|
errors.push('disabled_masks must be an array of strings');
|
|
193
86
|
}
|
|
194
|
-
// Validate disabled_tools
|
|
195
87
|
if (config.disabled_tools && !Array.isArray(config.disabled_tools)) {
|
|
196
88
|
errors.push('disabled_tools must be an array of strings');
|
|
197
89
|
}
|
|
198
|
-
// Validate agents
|
|
199
90
|
if (config.agents && typeof config.agents !== 'object') {
|
|
200
91
|
errors.push('agents must be an object');
|
|
201
92
|
}
|
|
202
|
-
// Validate masks config
|
|
203
93
|
if (config.masks) {
|
|
204
94
|
if (typeof config.masks !== 'object') {
|
|
205
95
|
errors.push('masks must be an object');
|
|
@@ -213,7 +103,6 @@ export function validateConfig(config) {
|
|
|
213
103
|
}
|
|
214
104
|
}
|
|
215
105
|
}
|
|
216
|
-
// Validate logging
|
|
217
106
|
if (config.logging) {
|
|
218
107
|
if (typeof config.logging !== 'object') {
|
|
219
108
|
errors.push('logging must be an object');
|
|
@@ -224,7 +113,6 @@ export function validateConfig(config) {
|
|
|
224
113
|
}
|
|
225
114
|
}
|
|
226
115
|
}
|
|
227
|
-
// Validate notifications
|
|
228
116
|
if (config.notifications) {
|
|
229
117
|
if (typeof config.notifications !== 'object') {
|
|
230
118
|
errors.push('notifications must be an object');
|
|
@@ -240,9 +128,6 @@ export function validateConfig(config) {
|
|
|
240
128
|
}
|
|
241
129
|
return errors;
|
|
242
130
|
}
|
|
243
|
-
// ============================================================================
|
|
244
|
-
// Export default for convenience
|
|
245
|
-
// ============================================================================
|
|
246
131
|
export default {
|
|
247
132
|
loadPluginConfig,
|
|
248
133
|
isToolEnabled,
|
package/dist/plugin/index.d.ts
CHANGED
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Maskweaver Plugin for opencode
|
|
3
|
-
*
|
|
4
|
-
* Key features:
|
|
5
|
-
* - Configuration-driven tool activation/deactivation
|
|
6
|
-
* - Auto-activation of default masks
|
|
7
|
-
* - Agent configuration overrides
|
|
8
|
-
* - Event-based lifecycle hooks
|
|
9
|
-
* - Memory and context management tools
|
|
10
|
-
* - Clean plugin architecture
|
|
11
|
-
*
|
|
12
|
-
* Based on oh-my-opencode plugin development patterns.
|
|
13
|
-
*/
|
|
14
1
|
import { type Plugin } from '@opencode-ai/plugin';
|
|
15
2
|
export declare const MaskweaverPlugin: Plugin;
|
|
16
3
|
declare const _default: {
|