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,8 +1 @@
1
- /**
2
- * Retrospect Type Definitions
3
- *
4
- * 회고 시스템의 타입 정의
5
- *
6
- * "Make the types express intent" - Kent Beck
7
- */
8
1
  export {};
@@ -1,61 +1,27 @@
1
1
  import type { LogLevel } from "./types.js";
2
- /**
3
- * Memory provider types
4
- */
5
2
  export type MemoryProviderType = "ollama" | "openai" | "voyage" | "openrouter" | "text-only";
6
- /**
7
- * Verify mode
8
- */
9
3
  export type VerifyMode = "auto" | "manual" | "off";
10
- /**
11
- * Reviewer types for verification
12
- */
13
4
  export type ReviewerType = "dummy-flash" | "dummy-human" | "dummy-premium";
14
- /**
15
- * Retrospect depth levels
16
- */
17
5
  export type RetrospectDepth = "quick" | "standard" | "deep";
18
- /**
19
- * Configuration for the Context feature (always enabled)
20
- */
21
6
  export interface ContextConfig {
22
7
  enabled: true;
23
8
  }
24
- /**
25
- * Configuration for the Memory feature
26
- */
27
9
  export interface MemoryConfig {
28
10
  enabled: boolean;
29
11
  provider: MemoryProviderType;
30
12
  }
31
- /**
32
- * Configuration for the Retrospect feature
33
- */
34
13
  export interface RetrospectConfig {
35
14
  enabled: boolean;
36
15
  }
37
- /**
38
- * Configuration for the Verify feature
39
- */
40
16
  export interface VerifyConfig {
41
17
  enabled: boolean;
42
18
  }
43
- /**
44
- * Feature configuration map
45
- */
46
19
  export interface FeaturesConfig {
47
- /** Context is always enabled */
48
20
  context: ContextConfig;
49
- /** Memory is optional */
50
21
  memory?: MemoryConfig;
51
- /** Retrospect is optional */
52
22
  retrospect?: RetrospectConfig;
53
- /** Verify is optional */
54
23
  verify?: VerifyConfig;
55
24
  }
56
- /**
57
- * Memory provider-specific configurations
58
- */
59
25
  export interface MemoryProviderConfigs {
60
26
  provider: MemoryProviderType;
61
27
  vectorStore?: {
@@ -86,9 +52,6 @@ export interface MemoryProviderConfigs {
86
52
  keywordWeight: number;
87
53
  };
88
54
  }
89
- /**
90
- * Verification configuration
91
- */
92
55
  export interface VerifyConfigOptions {
93
56
  mode: VerifyMode;
94
57
  reviewer: ReviewerType;
@@ -104,32 +67,16 @@ export interface VerifyConfigOptions {
104
67
  onTestFail?: boolean;
105
68
  };
106
69
  }
107
- /**
108
- * Logging configuration
109
- */
110
70
  export interface LoggingConfig {
111
71
  level: LogLevel;
112
72
  }
113
- /**
114
- * Main Maskweaver configuration
115
- */
116
73
  export interface MaskweaverConfig {
117
- /** Feature toggles */
118
74
  features: FeaturesConfig;
119
- /** Memory system configuration */
120
75
  memory?: MemoryProviderConfigs;
121
- /** Verification system configuration */
122
76
  verify?: VerifyConfigOptions;
123
- /** Logging configuration */
124
77
  logging?: LoggingConfig;
125
78
  }
126
- /**
127
- * Default configuration
128
- */
129
79
  export declare const DEFAULT_CONFIG: MaskweaverConfig;
130
- /**
131
- * Runtime memory configuration from maskweaver.config.json
132
- */
133
80
  export interface RuntimeMemoryConfig {
134
81
  provider: MemoryProviderType;
135
82
  model?: string;
@@ -137,9 +84,6 @@ export interface RuntimeMemoryConfig {
137
84
  enabled?: boolean;
138
85
  baseUrl?: string;
139
86
  }
140
- /**
141
- * Runtime GDC integration configuration from maskweaver.config.json
142
- */
143
87
  export interface RuntimeGdcConfig {
144
88
  enabled?: boolean | 'auto';
145
89
  strictVerify?: boolean;
@@ -163,82 +107,33 @@ export interface RuntimeConfig {
163
107
  gdc?: RuntimeGdcConfig;
164
108
  language?: string;
165
109
  }
166
- /** Cost tier for budget-aware scheduling */
167
110
  export type ModelCostTier = 'low' | 'medium' | 'high';
168
- /** Agent tier mapping */
169
111
  export type ModelTier = 'flash' | 'human' | 'premium';
170
- /** Known capability tags for task-model matching */
171
112
  export type ModelCapability = 'search' | 'formatting' | 'simple-coding' | 'file-ops' | 'coding' | 'testing' | 'refactoring' | 'architecture' | 'debugging' | 'reasoning' | 'complex-coding' | 'frontend' | 'backend' | 'database' | 'devops' | 'ml' | string;
172
- /**
173
- * A single model entry in the pool.
174
- * Each entry represents one AI model subscription the user has access to.
175
- */
176
113
  export interface ModelPoolEntry {
177
- /** Unique identifier for this model slot (e.g., "gemini-flash", "claude-opus") */
178
114
  id: string;
179
- /** Full model name as used by the provider (e.g., "google/antigravity-gemini-3-flash") */
180
115
  model: string;
181
- /** Which agent tier this model maps to */
182
116
  tier: ModelTier;
183
- /** Maximum concurrent uses allowed (API/subscription limit) */
184
117
  maxConcurrent: number;
185
- /** Task capabilities this model excels at */
186
118
  capabilities: ModelCapability[];
187
- /** Cost tier for budget-aware scheduling */
188
119
  costTier: ModelCostTier;
189
- /** Human-readable description */
190
120
  description?: string;
191
121
  }
192
- /**
193
- * DummyHumans configuration.
194
- * Supports two formats:
195
- * - Legacy: Record<string, string> mapping tier names to model IDs
196
- * - Pool: { pool: ModelPoolEntry[] } with detailed model definitions
197
- */
198
122
  export type DummyHumansConfig = Record<string, string> | {
199
123
  pool: ModelPoolEntry[];
200
124
  };
201
- /** Type guard for pool format */
202
125
  export declare function isPoolConfig(config: DummyHumansConfig): config is {
203
126
  pool: ModelPoolEntry[];
204
127
  };
205
- /**
206
- * Normalize legacy config to pool entries.
207
- * Converts { flash: "model-a", human: "model-b", premium: "model-c" }
208
- * into ModelPoolEntry[] with sensible defaults.
209
- */
210
128
  export declare function normalizeDummyHumansConfig(config: DummyHumansConfig): ModelPoolEntry[];
211
- /**
212
- * Runtime configuration from maskweaver.config.json
213
- */
214
129
  export interface RuntimeConfig {
215
130
  dummyHumans?: DummyHumansConfig;
216
131
  memory?: RuntimeMemoryConfig;
217
132
  gdc?: RuntimeGdcConfig;
218
133
  language?: string;
219
134
  }
220
- /**
221
- * Load maskweaver.config.json from project root or global config
222
- *
223
- * Searches in order:
224
- * 1. {basePath}/maskweaver.config.json
225
- * 2. {basePath}/.opencode/maskweaver.config.json
226
- * 3. ~/.config/opencode/maskweaver.config.json (global fallback)
227
- */
228
135
  export declare function loadRuntimeConfig(basePath?: string): RuntimeConfig;
229
- /**
230
- * Get memory provider configuration from runtime config
231
- */
232
136
  export declare function getMemoryProviderConfig(basePath?: string): RuntimeMemoryConfig | undefined;
233
- /**
234
- * Get GDC integration configuration from runtime config
235
- */
236
137
  export declare function getGdcConfig(basePath?: string): RuntimeGdcConfig | undefined;
237
- /**
238
- * Get operator model configuration from runtime config
239
- */
240
138
  export declare function getOperatorConfig(basePath?: string): RuntimeOperatorConfig | undefined;
241
- /**
242
- * Clear cached runtime config (for testing)
243
- */
244
139
  export declare function clearRuntimeConfigCache(): void;
@@ -1,9 +1,6 @@
1
1
  import * as fs from "node:fs";
2
2
  import * as os from "node:os";
3
3
  import * as path from "node:path";
4
- /**
5
- * Default configuration
6
- */
7
4
  export const DEFAULT_CONFIG = {
8
5
  features: {
9
6
  context: { enabled: true },
@@ -12,24 +9,16 @@ export const DEFAULT_CONFIG = {
12
9
  level: "info",
13
10
  },
14
11
  };
15
- /** Type guard for pool format */
16
12
  export function isPoolConfig(config) {
17
13
  return 'pool' in config && Array.isArray(config.pool);
18
14
  }
19
- /**
20
- * Normalize legacy config to pool entries.
21
- * Converts { flash: "model-a", human: "model-b", premium: "model-c" }
22
- * into ModelPoolEntry[] with sensible defaults.
23
- */
24
15
  export function normalizeDummyHumansConfig(config) {
25
- // Defensive guard: if called with null/undefined at runtime, return empty
26
16
  if (!config || typeof config !== 'object') {
27
17
  return [];
28
18
  }
29
19
  if (isPoolConfig(config)) {
30
20
  return config.pool;
31
21
  }
32
- // Legacy format → convert to pool entries
33
22
  const tierDefaults = {
34
23
  flash: { tier: 'flash', costTier: 'low', maxConcurrent: 5, capabilities: ['search', 'formatting', 'simple-coding', 'file-ops'] },
35
24
  human: { tier: 'human', costTier: 'medium', maxConcurrent: 2, capabilities: ['coding', 'testing', 'refactoring'] },
@@ -48,16 +37,7 @@ export function normalizeDummyHumansConfig(config) {
48
37
  }
49
38
  let cachedRuntimeConfig = null;
50
39
  let cachedConfigPath = null;
51
- /**
52
- * Load maskweaver.config.json from project root or global config
53
- *
54
- * Searches in order:
55
- * 1. {basePath}/maskweaver.config.json
56
- * 2. {basePath}/.opencode/maskweaver.config.json
57
- * 3. ~/.config/opencode/maskweaver.config.json (global fallback)
58
- */
59
40
  export function loadRuntimeConfig(basePath = process.cwd()) {
60
- // Return cached config if same path
61
41
  if (cachedRuntimeConfig && cachedConfigPath === basePath) {
62
42
  return cachedRuntimeConfig;
63
43
  }
@@ -80,35 +60,22 @@ export function loadRuntimeConfig(basePath = process.cwd()) {
80
60
  }
81
61
  }
82
62
  }
83
- // Return empty config if not found
84
63
  cachedRuntimeConfig = {};
85
64
  cachedConfigPath = basePath;
86
65
  return {};
87
66
  }
88
- /**
89
- * Get memory provider configuration from runtime config
90
- */
91
67
  export function getMemoryProviderConfig(basePath = process.cwd()) {
92
68
  const config = loadRuntimeConfig(basePath);
93
69
  return config.memory;
94
70
  }
95
- /**
96
- * Get GDC integration configuration from runtime config
97
- */
98
71
  export function getGdcConfig(basePath = process.cwd()) {
99
72
  const config = loadRuntimeConfig(basePath);
100
73
  return config.gdc;
101
74
  }
102
- /**
103
- * Get operator model configuration from runtime config
104
- */
105
75
  export function getOperatorConfig(basePath = process.cwd()) {
106
76
  const config = loadRuntimeConfig(basePath);
107
77
  return config.operator;
108
78
  }
109
- /**
110
- * Clear cached runtime config (for testing)
111
- */
112
79
  export function clearRuntimeConfigCache() {
113
80
  cachedRuntimeConfig = null;
114
81
  cachedConfigPath = null;
@@ -1,35 +1,17 @@
1
- /**
2
- * Error handling for Maskweaver
3
- */
4
- /**
5
- * Base error class for all Maskweaver errors
6
- */
7
1
  export declare class MaskweaverError extends Error {
8
2
  readonly code?: string | undefined;
9
3
  readonly context?: Record<string, unknown> | undefined;
10
4
  constructor(message: string, code?: string | undefined, context?: Record<string, unknown> | undefined);
11
5
  }
12
- /**
13
- * Configuration error
14
- */
15
6
  export declare class ConfigError extends MaskweaverError {
16
7
  constructor(message: string, context?: Record<string, unknown>);
17
8
  }
18
- /**
19
- * Provider error (for memory providers, etc.)
20
- */
21
9
  export declare class ProviderError extends MaskweaverError {
22
10
  constructor(message: string, context?: Record<string, unknown>);
23
11
  }
24
- /**
25
- * Storage error
26
- */
27
12
  export declare class StorageError extends MaskweaverError {
28
13
  constructor(message: string, context?: Record<string, unknown>);
29
14
  }
30
- /**
31
- * Validation error
32
- */
33
15
  export declare class ValidationError extends MaskweaverError {
34
16
  constructor(message: string, context?: Record<string, unknown>);
35
17
  }
@@ -1,9 +1,3 @@
1
- /**
2
- * Error handling for Maskweaver
3
- */
4
- /**
5
- * Base error class for all Maskweaver errors
6
- */
7
1
  export class MaskweaverError extends Error {
8
2
  code;
9
3
  context;
@@ -12,42 +6,29 @@ export class MaskweaverError extends Error {
12
6
  this.code = code;
13
7
  this.context = context;
14
8
  this.name = "MaskweaverError";
15
- // Maintains proper stack trace for where our error was thrown (only available on V8)
16
9
  if (Error.captureStackTrace) {
17
10
  Error.captureStackTrace(this, MaskweaverError);
18
11
  }
19
12
  }
20
13
  }
21
- /**
22
- * Configuration error
23
- */
24
14
  export class ConfigError extends MaskweaverError {
25
15
  constructor(message, context) {
26
16
  super(message, "CONFIG_ERROR", context);
27
17
  this.name = "ConfigError";
28
18
  }
29
19
  }
30
- /**
31
- * Provider error (for memory providers, etc.)
32
- */
33
20
  export class ProviderError extends MaskweaverError {
34
21
  constructor(message, context) {
35
22
  super(message, "PROVIDER_ERROR", context);
36
23
  this.name = "ProviderError";
37
24
  }
38
25
  }
39
- /**
40
- * Storage error
41
- */
42
26
  export class StorageError extends MaskweaverError {
43
27
  constructor(message, context) {
44
28
  super(message, "STORAGE_ERROR", context);
45
29
  this.name = "StorageError";
46
30
  }
47
31
  }
48
- /**
49
- * Validation error
50
- */
51
32
  export class ValidationError extends MaskweaverError {
52
33
  constructor(message, context) {
53
34
  super(message, "VALIDATION_ERROR", context);
@@ -1,65 +1,22 @@
1
- /**
2
- * Generate Agent Files from Pool Configuration
3
- *
4
- * Shared utility to create/update dummy-human agent .md files from
5
- * maskweaver.config.json pool entries. Used by both:
6
- * - Plugin startup (auto-generate if not exists)
7
- * - `weave sync-agents` command (force overwrite from user config)
8
- */
9
1
  import type { ModelPoolEntry } from './config.js';
10
2
  export interface GenerateAgentsResult {
11
- /** Files that were created (did not exist before) */
12
3
  created: string[];
13
- /** Files that were updated (existed and were overwritten) */
14
4
  updated: string[];
15
- /** Files that were skipped (existed and force was false) */
16
5
  skipped: string[];
17
- /** Error messages */
18
6
  errors: string[];
19
7
  }
20
8
  export interface GenerateAgentsOptions {
21
- /** Force overwrite existing files (default: false) */
22
9
  force?: boolean;
23
- /** Base project directory */
24
10
  projectDir?: string;
25
- /** Custom agents output directory (default: {projectDir}/.opencode/agents) */
26
11
  agentsDir?: string;
27
- /** Custom pool entries (if not provided, reads from config) */
28
12
  pool?: ModelPoolEntry[];
29
13
  }
30
- /**
31
- * Generate agent files from a ModelPoolEntry array.
32
- *
33
- * @param pool - Array of model pool entries
34
- * @param agentsDir - Output directory for agent .md files
35
- * @param options - Force overwrite option
36
- * @returns Result summary
37
- */
38
14
  export declare function generatePoolAgentFiles(pool: ModelPoolEntry[], agentsDir: string, options?: {
39
15
  force?: boolean;
40
16
  }): GenerateAgentsResult;
41
- /**
42
- * Read maskweaver.config.json (project or global) and generate agent files.
43
- *
44
- * Search order:
45
- * 1. {projectDir}/maskweaver.config.json
46
- * 2. {projectDir}/.opencode/maskweaver.config.json
47
- * 3. ~/.config/opencode/maskweaver.config.json (user global)
48
- *
49
- * @param projectDir - Project base directory
50
- * @param agentsDir - Output directory for agent .md files
51
- * @param options - Force overwrite and other options
52
- * @returns Result summary
53
- */
54
17
  export declare function generatePoolAgentFilesFromConfig(projectDir: string, agentsDir: string, options?: {
55
18
  force?: boolean;
56
19
  }): GenerateAgentsResult;
57
- /**
58
- * Default runtime config template (maskweaver.config.json).
59
- *
60
- * This is a minimal template with the standard tier entries but WITHOUT
61
- * model names — users must fill in their actual model IDs.
62
- */
63
20
  export declare const DEFAULT_RUNTIME_CONFIG_TEMPLATE: {
64
21
  readonly dummyHumans: {
65
22
  readonly pool: readonly [{
@@ -120,9 +77,6 @@ export declare const DEFAULT_RUNTIME_CONFIG_TEMPLATE: {
120
77
  };
121
78
  readonly language: "ko";
122
79
  };
123
- /**
124
- * Default plugin config template (.opencode/maskweaver.json).
125
- */
126
80
  export declare const DEFAULT_PLUGIN_CONFIG_TEMPLATE: {
127
81
  $schema: string;
128
82
  masks: {
@@ -137,29 +91,6 @@ export declare const DEFAULT_PLUGIN_CONFIG_TEMPLATE: {
137
91
  };
138
92
  };
139
93
  };
140
- /**
141
- * Write a default maskweaver.config.json to the project directory.
142
- * Does NOT overwrite if the file already exists.
143
- *
144
- * @param projectDir - Project base directory
145
- * @returns The path to the created file, or null if it already existed
146
- */
147
94
  export declare function writeDefaultRuntimeConfig(projectDir: string): string | null;
148
- /**
149
- * Write a default .opencode/maskweaver.json (plugin config) to the project.
150
- * Does NOT overwrite if the file already exists.
151
- *
152
- * @param projectDir - Project base directory
153
- * @returns The path to the created file, or null if it already existed
154
- */
155
95
  export declare function writeDefaultPluginConfig(projectDir: string): string | null;
156
- /**
157
- * Check if a user-level config exists at ~/.config/opencode/ and return it.
158
- *
159
- * Search order:
160
- * 1. ~/.config/opencode/maskweaver.config.json
161
- * 2. ~/.config/opencode/maskweaver.json (plugin config with agents)
162
- *
163
- * @returns The config path if found, or null
164
- */
165
96
  export declare function findUserGlobalConfig(): string | null;
@@ -1,21 +1,7 @@
1
- /**
2
- * Generate Agent Files from Pool Configuration
3
- *
4
- * Shared utility to create/update dummy-human agent .md files from
5
- * maskweaver.config.json pool entries. Used by both:
6
- * - Plugin startup (auto-generate if not exists)
7
- * - `weave sync-agents` command (force overwrite from user config)
8
- */
9
1
  import * as fs from 'node:fs';
10
2
  import * as path from 'node:path';
11
3
  import * as os from 'node:os';
12
4
  import { loadRuntimeConfig, normalizeDummyHumansConfig } from './config.js';
13
- // ============================================================================
14
- // Agent File Template
15
- // ============================================================================
16
- /**
17
- * Generate the content for a dummy-human agent .md file
18
- */
19
5
  function buildAgentFileContent(entry) {
20
6
  const lines = [
21
7
  '---',
@@ -34,17 +20,6 @@ function buildAgentFileContent(entry) {
34
20
  ];
35
21
  return lines.join('\n');
36
22
  }
37
- // ============================================================================
38
- // Agent File Generation
39
- // ============================================================================
40
- /**
41
- * Generate agent files from a ModelPoolEntry array.
42
- *
43
- * @param pool - Array of model pool entries
44
- * @param agentsDir - Output directory for agent .md files
45
- * @param options - Force overwrite option
46
- * @returns Result summary
47
- */
48
23
  export function generatePoolAgentFiles(pool, agentsDir, options = {}) {
49
24
  const result = {
50
25
  created: [],
@@ -56,7 +31,6 @@ export function generatePoolAgentFiles(pool, agentsDir, options = {}) {
56
31
  result.errors.push('Pool is empty or undefined. No agents to generate.');
57
32
  return result;
58
33
  }
59
- // Ensure agents directory exists
60
34
  if (!fs.existsSync(agentsDir)) {
61
35
  try {
62
36
  fs.mkdirSync(agentsDir, { recursive: true });
@@ -74,7 +48,6 @@ export function generatePoolAgentFiles(pool, agentsDir, options = {}) {
74
48
  result.skipped.push(agentPath);
75
49
  continue;
76
50
  }
77
- // Validate: model must not be empty
78
51
  if (!entry.model || entry.model.trim() === '') {
79
52
  result.errors.push(`Entry "${entry.id}" has no model configured. Skipping.`);
80
53
  continue;
@@ -95,24 +68,7 @@ export function generatePoolAgentFiles(pool, agentsDir, options = {}) {
95
68
  }
96
69
  return result;
97
70
  }
98
- // ============================================================================
99
- // Config-Based Agent Generation
100
- // ============================================================================
101
- /**
102
- * Read maskweaver.config.json (project or global) and generate agent files.
103
- *
104
- * Search order:
105
- * 1. {projectDir}/maskweaver.config.json
106
- * 2. {projectDir}/.opencode/maskweaver.config.json
107
- * 3. ~/.config/opencode/maskweaver.config.json (user global)
108
- *
109
- * @param projectDir - Project base directory
110
- * @param agentsDir - Output directory for agent .md files
111
- * @param options - Force overwrite and other options
112
- * @returns Result summary
113
- */
114
71
  export function generatePoolAgentFilesFromConfig(projectDir, agentsDir, options = {}) {
115
- // Try project config first
116
72
  const projectConfig = loadRuntimeConfig(projectDir);
117
73
  if (projectConfig.dummyHumans) {
118
74
  const pool = normalizeDummyHumansConfig(projectConfig.dummyHumans);
@@ -120,7 +76,6 @@ export function generatePoolAgentFilesFromConfig(projectDir, agentsDir, options
120
76
  return generatePoolAgentFiles(pool, agentsDir, options);
121
77
  }
122
78
  }
123
- // Try user global config (~/.config/opencode/maskweaver.config.json)
124
79
  const homeDir = os.homedir();
125
80
  const globalConfigPath = path.join(homeDir, '.config', 'opencode', 'maskweaver.config.json');
126
81
  if (fs.existsSync(globalConfigPath)) {
@@ -145,15 +100,6 @@ export function generatePoolAgentFilesFromConfig(projectDir, agentsDir, options
145
100
  errors: ['No maskweaver.config.json found with dummyHumans configuration. Create one or run `weave init-config` to generate a default.'],
146
101
  };
147
102
  }
148
- // ============================================================================
149
- // Default Config File Creator
150
- // ============================================================================
151
- /**
152
- * Default runtime config template (maskweaver.config.json).
153
- *
154
- * This is a minimal template with the standard tier entries but WITHOUT
155
- * model names — users must fill in their actual model IDs.
156
- */
157
103
  export const DEFAULT_RUNTIME_CONFIG_TEMPLATE = {
158
104
  dummyHumans: {
159
105
  pool: [
@@ -220,9 +166,6 @@ export const DEFAULT_RUNTIME_CONFIG_TEMPLATE = {
220
166
  },
221
167
  language: 'ko',
222
168
  };
223
- /**
224
- * Default plugin config template (.opencode/maskweaver.json).
225
- */
226
169
  export const DEFAULT_PLUGIN_CONFIG_TEMPLATE = {
227
170
  $schema: 'https://raw.githubusercontent.com/ulgerang/maskweaver/master/schemas/plugin-config.json',
228
171
  masks: {
@@ -237,17 +180,10 @@ export const DEFAULT_PLUGIN_CONFIG_TEMPLATE = {
237
180
  },
238
181
  },
239
182
  };
240
- /**
241
- * Write a default maskweaver.config.json to the project directory.
242
- * Does NOT overwrite if the file already exists.
243
- *
244
- * @param projectDir - Project base directory
245
- * @returns The path to the created file, or null if it already existed
246
- */
247
183
  export function writeDefaultRuntimeConfig(projectDir) {
248
184
  const targetPath = path.join(projectDir, 'maskweaver.config.json');
249
185
  if (fs.existsSync(targetPath)) {
250
- return null; // Already exists, don't overwrite
186
+ return null;
251
187
  }
252
188
  try {
253
189
  fs.writeFileSync(targetPath, JSON.stringify(DEFAULT_RUNTIME_CONFIG_TEMPLATE, null, 2) + '\n', 'utf-8');
@@ -257,20 +193,12 @@ export function writeDefaultRuntimeConfig(projectDir) {
257
193
  return null;
258
194
  }
259
195
  }
260
- /**
261
- * Write a default .opencode/maskweaver.json (plugin config) to the project.
262
- * Does NOT overwrite if the file already exists.
263
- *
264
- * @param projectDir - Project base directory
265
- * @returns The path to the created file, or null if it already existed
266
- */
267
196
  export function writeDefaultPluginConfig(projectDir) {
268
197
  const opencodeDir = path.join(projectDir, '.opencode');
269
198
  const targetPath = path.join(opencodeDir, 'maskweaver.json');
270
199
  if (fs.existsSync(targetPath)) {
271
- return null; // Already exists, don't overwrite
200
+ return null;
272
201
  }
273
- // Ensure .opencode directory exists
274
202
  if (!fs.existsSync(opencodeDir)) {
275
203
  try {
276
204
  fs.mkdirSync(opencodeDir, { recursive: true });
@@ -287,18 +215,6 @@ export function writeDefaultPluginConfig(projectDir) {
287
215
  return null;
288
216
  }
289
217
  }
290
- // ============================================================================
291
- // User Config Detection
292
- // ============================================================================
293
- /**
294
- * Check if a user-level config exists at ~/.config/opencode/ and return it.
295
- *
296
- * Search order:
297
- * 1. ~/.config/opencode/maskweaver.config.json
298
- * 2. ~/.config/opencode/maskweaver.json (plugin config with agents)
299
- *
300
- * @returns The config path if found, or null
301
- */
302
218
  export function findUserGlobalConfig() {
303
219
  const homeDir = os.homedir();
304
220
  const candidates = [