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.
Files changed (246) hide show
  1. package/README.ko.md +279 -325
  2. package/README.md +109 -113
  3. package/assets/commands/meta/commands.json +34 -34
  4. package/assets/commands/weave-agents.md +12 -52
  5. package/assets/commands/weave-approve.md +12 -51
  6. package/assets/commands/weave-archive.md +21 -0
  7. package/assets/commands/weave-build.md +20 -89
  8. package/assets/commands/weave-craft.md +22 -43
  9. package/assets/commands/weave-help.md +37 -106
  10. package/assets/commands/weave-init.md +26 -108
  11. package/assets/commands/weave-interview.md +13 -111
  12. package/assets/commands/weave-map.md +13 -99
  13. package/assets/commands/weave-prepare.md +23 -69
  14. package/assets/commands/weave-refine-plan.md +26 -59
  15. package/assets/commands/weave-repair.md +22 -70
  16. package/assets/commands/weave-status.md +22 -155
  17. package/assets/commands/weave-troubleshoot.md +11 -47
  18. package/assets/commands/weave-verify.md +23 -44
  19. package/assets/commands/weave-worktree.md +27 -69
  20. package/dist/cli/doctor.js +5 -21
  21. package/dist/cli/install.d.ts +0 -8
  22. package/dist/cli/install.js +0 -39
  23. package/dist/context/config.d.ts +0 -22
  24. package/dist/context/config.js +0 -28
  25. package/dist/context/feature.d.ts +0 -39
  26. package/dist/context/feature.js +0 -77
  27. package/dist/context/files.d.ts +0 -13
  28. package/dist/context/files.js +1 -24
  29. package/dist/context/index.d.ts +0 -7
  30. package/dist/context/index.js +0 -12
  31. package/dist/context/project.d.ts +0 -21
  32. package/dist/context/project.js +0 -30
  33. package/dist/context/types.d.ts +0 -48
  34. package/dist/context/types.js +0 -12
  35. package/dist/context/utils.d.ts +0 -18
  36. package/dist/context/utils.js +0 -27
  37. package/dist/core/engine/promptBuilder.d.ts +0 -17
  38. package/dist/core/engine/promptBuilder.js +0 -28
  39. package/dist/core/index.d.ts +0 -6
  40. package/dist/core/index.js +0 -9
  41. package/dist/core/loader/MaskLoader.d.ts +0 -23
  42. package/dist/core/loader/MaskLoader.js +0 -29
  43. package/dist/core/schema/types.d.ts +0 -47
  44. package/dist/core/schema/types.js +0 -6
  45. package/dist/core/schema/validator.d.ts +0 -14
  46. package/dist/core/schema/validator.js +0 -18
  47. package/dist/i18n/index.d.ts +0 -18
  48. package/dist/i18n/index.js +4 -23
  49. package/dist/index.d.ts +0 -8
  50. package/dist/index.js +0 -8
  51. package/dist/lib.d.ts +0 -5
  52. package/dist/lib.js +0 -12
  53. package/dist/memory/chunking.d.ts +0 -22
  54. package/dist/memory/chunking.js +2 -37
  55. package/dist/memory/core.d.ts +0 -29
  56. package/dist/memory/core.js +1 -52
  57. package/dist/memory/index.d.ts +0 -5
  58. package/dist/memory/index.js +0 -10
  59. package/dist/memory/indexer.d.ts +0 -21
  60. package/dist/memory/indexer.js +0 -44
  61. package/dist/memory/providers/examples.d.ts +0 -5
  62. package/dist/memory/providers/examples.js +4 -64
  63. package/dist/memory/providers/factory.d.ts +0 -44
  64. package/dist/memory/providers/factory.js +0 -46
  65. package/dist/memory/providers/index.d.ts +0 -26
  66. package/dist/memory/providers/index.js +0 -28
  67. package/dist/memory/providers/ollama.d.ts +0 -6
  68. package/dist/memory/providers/ollama.js +1 -8
  69. package/dist/memory/providers/openai.d.ts +0 -6
  70. package/dist/memory/providers/openai.js +1 -8
  71. package/dist/memory/providers/openrouter.d.ts +0 -6
  72. package/dist/memory/providers/openrouter.js +0 -8
  73. package/dist/memory/providers/text-only.d.ts +0 -13
  74. package/dist/memory/providers/text-only.js +0 -17
  75. package/dist/memory/providers/types.d.ts +0 -39
  76. package/dist/memory/providers/types.js +0 -7
  77. package/dist/memory/providers/voyage.d.ts +0 -22
  78. package/dist/memory/providers/voyage.js +1 -24
  79. package/dist/memory/search/hybrid.d.ts +0 -12
  80. package/dist/memory/search/hybrid.js +1 -22
  81. package/dist/memory/store/sqlite.d.ts +0 -72
  82. package/dist/memory/store/sqlite.js +4 -127
  83. package/dist/plugin/config/index.d.ts +0 -112
  84. package/dist/plugin/config/index.js +0 -115
  85. package/dist/plugin/index.d.ts +0 -13
  86. package/dist/plugin/index.js +1 -124
  87. package/dist/plugin/tools/command-registry.d.ts +0 -6
  88. package/dist/plugin/tools/command-registry.js +0 -14
  89. package/dist/plugin/tools/context.d.ts +0 -12
  90. package/dist/plugin/tools/context.js +0 -58
  91. package/dist/plugin/tools/maskSave.d.ts +0 -3
  92. package/dist/plugin/tools/maskSave.js +0 -3
  93. package/dist/plugin/tools/memoryGet.d.ts +0 -3
  94. package/dist/plugin/tools/memoryGet.js +0 -3
  95. package/dist/plugin/tools/memoryIndexer.d.ts +0 -3
  96. package/dist/plugin/tools/memoryIndexer.js +0 -10
  97. package/dist/plugin/tools/memorySearch.d.ts +0 -31
  98. package/dist/plugin/tools/memorySearch.js +0 -79
  99. package/dist/plugin/tools/memoryWrite.d.ts +0 -8
  100. package/dist/plugin/tools/memoryWrite.js +0 -32
  101. package/dist/plugin/tools/retrospect.d.ts +0 -3
  102. package/dist/plugin/tools/retrospect.js +0 -3
  103. package/dist/plugin/tools/slashcommand.d.ts +0 -11
  104. package/dist/plugin/tools/slashcommand.js +0 -38
  105. package/dist/plugin/tools/squad.d.ts +0 -12
  106. package/dist/plugin/tools/squad.js +11 -83
  107. package/dist/plugin/tools/weave.d.ts +0 -6
  108. package/dist/plugin/tools/weave.js +0 -78
  109. package/dist/plugin/types.d.ts +0 -20
  110. package/dist/plugin/types.js +0 -7
  111. package/dist/retrospect/index.d.ts +0 -7
  112. package/dist/retrospect/index.js +0 -9
  113. package/dist/retrospect/mask-save.d.ts +0 -12
  114. package/dist/retrospect/mask-save.js +1 -80
  115. package/dist/retrospect/retrospect.d.ts +0 -18
  116. package/dist/retrospect/retrospect.js +0 -63
  117. package/dist/retrospect/strategies/base.d.ts +0 -15
  118. package/dist/retrospect/strategies/base.js +0 -7
  119. package/dist/retrospect/strategies/deep.d.ts +0 -12
  120. package/dist/retrospect/strategies/deep.js +0 -24
  121. package/dist/retrospect/strategies/index.d.ts +0 -12
  122. package/dist/retrospect/strategies/index.js +0 -12
  123. package/dist/retrospect/strategies/quick.d.ts +0 -12
  124. package/dist/retrospect/strategies/quick.js +0 -19
  125. package/dist/retrospect/strategies/standard.d.ts +0 -12
  126. package/dist/retrospect/strategies/standard.js +0 -15
  127. package/dist/retrospect/types.d.ts +0 -7
  128. package/dist/retrospect/types.js +0 -7
  129. package/dist/shared/config.d.ts +0 -105
  130. package/dist/shared/config.js +0 -33
  131. package/dist/shared/errors.d.ts +0 -18
  132. package/dist/shared/errors.js +0 -19
  133. package/dist/shared/generate-agents.d.ts +0 -69
  134. package/dist/shared/generate-agents.js +2 -86
  135. package/dist/shared/image.d.ts +0 -67
  136. package/dist/shared/image.js +6 -104
  137. package/dist/shared/index.d.ts +0 -5
  138. package/dist/shared/index.js +0 -7
  139. package/dist/shared/model-registry.d.ts +0 -72
  140. package/dist/shared/model-registry.js +5 -95
  141. package/dist/shared/types.d.ts +0 -15
  142. package/dist/shared/types.js +0 -3
  143. package/dist/shared-context/dag.d.ts +0 -105
  144. package/dist/shared-context/dag.js +3 -114
  145. package/dist/shared-context/index.d.ts +0 -5
  146. package/dist/shared-context/index.js +0 -15
  147. package/dist/shared-context/logger.d.ts +0 -37
  148. package/dist/shared-context/logger.js +0 -41
  149. package/dist/shared-context/parallel-executor.d.ts +0 -54
  150. package/dist/shared-context/parallel-executor.js +4 -56
  151. package/dist/shared-context/session.d.ts +0 -56
  152. package/dist/shared-context/session.js +0 -47
  153. package/dist/shared-context/squad.d.ts +0 -68
  154. package/dist/shared-context/squad.js +0 -63
  155. package/dist/shared-context/storage.d.ts +0 -132
  156. package/dist/shared-context/storage.js +0 -116
  157. package/dist/shared-context/task.d.ts +0 -120
  158. package/dist/shared-context/task.js +0 -152
  159. package/dist/shared-context/test/dag.test.js +9 -14
  160. package/dist/shared-context/test/logger.test.d.ts +0 -8
  161. package/dist/shared-context/test/logger.test.js +0 -52
  162. package/dist/shared-context/test/session.test.d.ts +0 -7
  163. package/dist/shared-context/test/session.test.js +0 -63
  164. package/dist/shared-context/test/squad.test.d.ts +0 -10
  165. package/dist/shared-context/test/squad.test.js +2 -68
  166. package/dist/shared-context/test/storage.test.d.ts +0 -8
  167. package/dist/shared-context/test/storage.test.js +0 -68
  168. package/dist/shared-context/test/task.test.d.ts +0 -7
  169. package/dist/shared-context/test/task.test.js +0 -54
  170. package/dist/shared-context/test/watchdog.test.d.ts +0 -7
  171. package/dist/shared-context/test/watchdog.test.js +3 -58
  172. package/dist/shared-context/types.d.ts +0 -215
  173. package/dist/shared-context/types.js +0 -125
  174. package/dist/shared-context/watchdog.d.ts +0 -127
  175. package/dist/shared-context/watchdog.js +0 -148
  176. package/dist/shared-context/worktree.d.ts +0 -68
  177. package/dist/shared-context/worktree.js +2 -34
  178. package/dist/verify/budget.d.ts +0 -29
  179. package/dist/verify/budget.js +0 -34
  180. package/dist/verify/critical-files.d.ts +0 -17
  181. package/dist/verify/critical-files.js +0 -37
  182. package/dist/verify/escalation.d.ts +0 -20
  183. package/dist/verify/escalation.js +0 -22
  184. package/dist/verify/index.d.ts +0 -5
  185. package/dist/verify/index.js +0 -11
  186. package/dist/verify/prompts.d.ts +0 -20
  187. package/dist/verify/prompts.js +0 -20
  188. package/dist/verify/types.d.ts +0 -26
  189. package/dist/verify/types.js +1 -12
  190. package/dist/verify/verifier.d.ts +0 -29
  191. package/dist/verify/verifier.js +0 -54
  192. package/dist/version.d.ts +1 -16
  193. package/dist/version.js +1 -16
  194. package/dist/weave/bridge.d.ts +0 -35
  195. package/dist/weave/bridge.js +0 -51
  196. package/dist/weave/environment/detector.d.ts +0 -6
  197. package/dist/weave/environment/detector.js +4 -45
  198. package/dist/weave/environment/index.d.ts +0 -19
  199. package/dist/weave/environment/index.js +1 -39
  200. package/dist/weave/environment/issues.d.ts +0 -35
  201. package/dist/weave/environment/issues.js +0 -59
  202. package/dist/weave/git.d.ts +0 -8
  203. package/dist/weave/git.js +0 -8
  204. package/dist/weave/index.d.ts +0 -13
  205. package/dist/weave/index.js +2 -28
  206. package/dist/weave/knowledge/global.d.ts +0 -39
  207. package/dist/weave/knowledge/global.js +2 -78
  208. package/dist/weave/loop.js +0 -3
  209. package/dist/weave/orchestrator.d.ts +0 -69
  210. package/dist/weave/orchestrator.js +1 -101
  211. package/dist/weave/phase-manager.d.ts +0 -64
  212. package/dist/weave/phase-manager.js +0 -89
  213. package/dist/weave/security/secret-scan.d.ts +0 -14
  214. package/dist/weave/security/secret-scan.js +0 -19
  215. package/dist/weave/stages/build.js +0 -15
  216. package/dist/weave/stages/execute.d.ts +0 -42
  217. package/dist/weave/stages/execute.js +4 -86
  218. package/dist/weave/stages/handoff.d.ts +0 -7
  219. package/dist/weave/stages/handoff.js +0 -43
  220. package/dist/weave/stages/index.d.ts +0 -3
  221. package/dist/weave/stages/index.js +0 -3
  222. package/dist/weave/stages/intake.d.ts +0 -8
  223. package/dist/weave/stages/intake.js +5 -65
  224. package/dist/weave/stages/map.d.ts +0 -1
  225. package/dist/weave/stages/openspec.d.ts +0 -1
  226. package/dist/weave/stages/plan.d.ts +0 -11
  227. package/dist/weave/stages/plan.js +1 -53
  228. package/dist/weave/stages/refine.d.ts +0 -7
  229. package/dist/weave/stages/refine.js +0 -7
  230. package/dist/weave/stages/research.d.ts +0 -6
  231. package/dist/weave/stages/research.js +0 -6
  232. package/dist/weave/stages/spec.d.ts +0 -12
  233. package/dist/weave/stages/spec.js +0 -17
  234. package/dist/weave/types.d.ts +0 -20
  235. package/dist/weave/types.js +0 -5
  236. package/dist/weave/verification/commands.d.ts +0 -12
  237. package/dist/weave/verification/commands.js +0 -19
  238. package/dist/weave/verification/index.d.ts +0 -6
  239. package/dist/weave/verification/index.js +1 -19
  240. package/dist/weave/verification/playwright.d.ts +0 -47
  241. package/dist/weave/verification/playwright.js +1 -90
  242. package/dist/weave/worktree.d.ts +0 -16
  243. package/dist/weave/worktree.js +0 -23
  244. package/dist/weave/yaml-repair.d.ts +0 -39
  245. package/dist/weave/yaml-repair.js +13 -116
  246. 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,
@@ -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: {