maskweaver 0.9.4 → 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 (227) hide show
  1. package/dist/cli/doctor.js +5 -21
  2. package/dist/cli/install.d.ts +0 -8
  3. package/dist/cli/install.js +0 -39
  4. package/dist/context/config.d.ts +0 -22
  5. package/dist/context/config.js +0 -28
  6. package/dist/context/feature.d.ts +0 -39
  7. package/dist/context/feature.js +0 -77
  8. package/dist/context/files.d.ts +0 -13
  9. package/dist/context/files.js +1 -24
  10. package/dist/context/index.d.ts +0 -7
  11. package/dist/context/index.js +0 -12
  12. package/dist/context/project.d.ts +0 -21
  13. package/dist/context/project.js +0 -30
  14. package/dist/context/types.d.ts +0 -48
  15. package/dist/context/types.js +0 -12
  16. package/dist/context/utils.d.ts +0 -18
  17. package/dist/context/utils.js +0 -27
  18. package/dist/core/engine/promptBuilder.d.ts +0 -17
  19. package/dist/core/engine/promptBuilder.js +0 -28
  20. package/dist/core/index.d.ts +0 -6
  21. package/dist/core/index.js +0 -9
  22. package/dist/core/loader/MaskLoader.d.ts +0 -23
  23. package/dist/core/loader/MaskLoader.js +0 -29
  24. package/dist/core/schema/types.d.ts +0 -47
  25. package/dist/core/schema/types.js +0 -6
  26. package/dist/core/schema/validator.d.ts +0 -14
  27. package/dist/core/schema/validator.js +0 -18
  28. package/dist/i18n/index.d.ts +0 -18
  29. package/dist/i18n/index.js +4 -23
  30. package/dist/index.d.ts +0 -8
  31. package/dist/index.js +0 -8
  32. package/dist/lib.d.ts +0 -5
  33. package/dist/lib.js +0 -12
  34. package/dist/memory/chunking.d.ts +0 -22
  35. package/dist/memory/chunking.js +2 -37
  36. package/dist/memory/core.d.ts +0 -29
  37. package/dist/memory/core.js +1 -52
  38. package/dist/memory/index.d.ts +0 -5
  39. package/dist/memory/index.js +0 -10
  40. package/dist/memory/indexer.d.ts +0 -21
  41. package/dist/memory/indexer.js +0 -44
  42. package/dist/memory/providers/examples.d.ts +0 -5
  43. package/dist/memory/providers/examples.js +4 -64
  44. package/dist/memory/providers/factory.d.ts +0 -44
  45. package/dist/memory/providers/factory.js +0 -46
  46. package/dist/memory/providers/index.d.ts +0 -26
  47. package/dist/memory/providers/index.js +0 -28
  48. package/dist/memory/providers/ollama.d.ts +0 -6
  49. package/dist/memory/providers/ollama.js +1 -8
  50. package/dist/memory/providers/openai.d.ts +0 -6
  51. package/dist/memory/providers/openai.js +1 -8
  52. package/dist/memory/providers/openrouter.d.ts +0 -6
  53. package/dist/memory/providers/openrouter.js +0 -8
  54. package/dist/memory/providers/text-only.d.ts +0 -13
  55. package/dist/memory/providers/text-only.js +0 -17
  56. package/dist/memory/providers/types.d.ts +0 -39
  57. package/dist/memory/providers/types.js +0 -7
  58. package/dist/memory/providers/voyage.d.ts +0 -22
  59. package/dist/memory/providers/voyage.js +1 -24
  60. package/dist/memory/search/hybrid.d.ts +0 -12
  61. package/dist/memory/search/hybrid.js +1 -22
  62. package/dist/memory/store/sqlite.d.ts +0 -72
  63. package/dist/memory/store/sqlite.js +4 -127
  64. package/dist/plugin/config/index.d.ts +0 -112
  65. package/dist/plugin/config/index.js +0 -115
  66. package/dist/plugin/index.d.ts +0 -13
  67. package/dist/plugin/index.js +1 -123
  68. package/dist/plugin/tools/command-registry.d.ts +0 -6
  69. package/dist/plugin/tools/command-registry.js +0 -14
  70. package/dist/plugin/tools/context.d.ts +0 -12
  71. package/dist/plugin/tools/context.js +0 -58
  72. package/dist/plugin/tools/maskSave.d.ts +0 -3
  73. package/dist/plugin/tools/maskSave.js +0 -3
  74. package/dist/plugin/tools/memoryGet.d.ts +0 -3
  75. package/dist/plugin/tools/memoryGet.js +0 -3
  76. package/dist/plugin/tools/memoryIndexer.d.ts +0 -3
  77. package/dist/plugin/tools/memoryIndexer.js +0 -10
  78. package/dist/plugin/tools/memorySearch.d.ts +0 -31
  79. package/dist/plugin/tools/memorySearch.js +0 -79
  80. package/dist/plugin/tools/memoryWrite.d.ts +0 -8
  81. package/dist/plugin/tools/memoryWrite.js +0 -32
  82. package/dist/plugin/tools/retrospect.d.ts +0 -3
  83. package/dist/plugin/tools/retrospect.js +0 -3
  84. package/dist/plugin/tools/slashcommand.d.ts +0 -11
  85. package/dist/plugin/tools/slashcommand.js +0 -38
  86. package/dist/plugin/tools/squad.d.ts +0 -12
  87. package/dist/plugin/tools/squad.js +11 -83
  88. package/dist/plugin/tools/weave.d.ts +0 -6
  89. package/dist/plugin/tools/weave.js +0 -78
  90. package/dist/plugin/types.d.ts +0 -20
  91. package/dist/plugin/types.js +0 -7
  92. package/dist/retrospect/index.d.ts +0 -7
  93. package/dist/retrospect/index.js +0 -9
  94. package/dist/retrospect/mask-save.d.ts +0 -12
  95. package/dist/retrospect/mask-save.js +1 -80
  96. package/dist/retrospect/retrospect.d.ts +0 -18
  97. package/dist/retrospect/retrospect.js +0 -63
  98. package/dist/retrospect/strategies/base.d.ts +0 -15
  99. package/dist/retrospect/strategies/base.js +0 -7
  100. package/dist/retrospect/strategies/deep.d.ts +0 -12
  101. package/dist/retrospect/strategies/deep.js +0 -24
  102. package/dist/retrospect/strategies/index.d.ts +0 -12
  103. package/dist/retrospect/strategies/index.js +0 -12
  104. package/dist/retrospect/strategies/quick.d.ts +0 -12
  105. package/dist/retrospect/strategies/quick.js +0 -19
  106. package/dist/retrospect/strategies/standard.d.ts +0 -12
  107. package/dist/retrospect/strategies/standard.js +0 -15
  108. package/dist/retrospect/types.d.ts +0 -7
  109. package/dist/retrospect/types.js +0 -7
  110. package/dist/shared/config.d.ts +0 -105
  111. package/dist/shared/config.js +0 -33
  112. package/dist/shared/errors.d.ts +0 -18
  113. package/dist/shared/errors.js +0 -19
  114. package/dist/shared/generate-agents.d.ts +0 -69
  115. package/dist/shared/generate-agents.js +2 -86
  116. package/dist/shared/image.d.ts +0 -67
  117. package/dist/shared/image.js +6 -104
  118. package/dist/shared/index.d.ts +0 -5
  119. package/dist/shared/index.js +0 -7
  120. package/dist/shared/model-registry.d.ts +0 -72
  121. package/dist/shared/model-registry.js +5 -95
  122. package/dist/shared/types.d.ts +0 -15
  123. package/dist/shared/types.js +0 -3
  124. package/dist/shared-context/dag.d.ts +0 -105
  125. package/dist/shared-context/dag.js +3 -114
  126. package/dist/shared-context/index.d.ts +0 -5
  127. package/dist/shared-context/index.js +0 -15
  128. package/dist/shared-context/logger.d.ts +0 -37
  129. package/dist/shared-context/logger.js +0 -41
  130. package/dist/shared-context/parallel-executor.d.ts +0 -54
  131. package/dist/shared-context/parallel-executor.js +4 -56
  132. package/dist/shared-context/session.d.ts +0 -56
  133. package/dist/shared-context/session.js +0 -47
  134. package/dist/shared-context/squad.d.ts +0 -68
  135. package/dist/shared-context/squad.js +0 -63
  136. package/dist/shared-context/storage.d.ts +0 -132
  137. package/dist/shared-context/storage.js +0 -116
  138. package/dist/shared-context/task.d.ts +0 -120
  139. package/dist/shared-context/task.js +0 -152
  140. package/dist/shared-context/test/dag.test.js +9 -14
  141. package/dist/shared-context/test/logger.test.d.ts +0 -8
  142. package/dist/shared-context/test/logger.test.js +0 -52
  143. package/dist/shared-context/test/session.test.d.ts +0 -7
  144. package/dist/shared-context/test/session.test.js +0 -63
  145. package/dist/shared-context/test/squad.test.d.ts +0 -10
  146. package/dist/shared-context/test/squad.test.js +2 -68
  147. package/dist/shared-context/test/storage.test.d.ts +0 -8
  148. package/dist/shared-context/test/storage.test.js +0 -68
  149. package/dist/shared-context/test/task.test.d.ts +0 -7
  150. package/dist/shared-context/test/task.test.js +0 -54
  151. package/dist/shared-context/test/watchdog.test.d.ts +0 -7
  152. package/dist/shared-context/test/watchdog.test.js +3 -58
  153. package/dist/shared-context/types.d.ts +0 -215
  154. package/dist/shared-context/types.js +0 -125
  155. package/dist/shared-context/watchdog.d.ts +0 -127
  156. package/dist/shared-context/watchdog.js +0 -148
  157. package/dist/shared-context/worktree.d.ts +0 -68
  158. package/dist/shared-context/worktree.js +2 -34
  159. package/dist/verify/budget.d.ts +0 -29
  160. package/dist/verify/budget.js +0 -34
  161. package/dist/verify/critical-files.d.ts +0 -17
  162. package/dist/verify/critical-files.js +0 -37
  163. package/dist/verify/escalation.d.ts +0 -20
  164. package/dist/verify/escalation.js +0 -22
  165. package/dist/verify/index.d.ts +0 -5
  166. package/dist/verify/index.js +0 -11
  167. package/dist/verify/prompts.d.ts +0 -20
  168. package/dist/verify/prompts.js +0 -20
  169. package/dist/verify/types.d.ts +0 -26
  170. package/dist/verify/types.js +1 -12
  171. package/dist/verify/verifier.d.ts +0 -29
  172. package/dist/verify/verifier.js +0 -54
  173. package/dist/version.d.ts +1 -16
  174. package/dist/version.js +1 -16
  175. package/dist/weave/bridge.d.ts +0 -35
  176. package/dist/weave/bridge.js +0 -51
  177. package/dist/weave/environment/detector.d.ts +0 -6
  178. package/dist/weave/environment/detector.js +4 -45
  179. package/dist/weave/environment/index.d.ts +0 -19
  180. package/dist/weave/environment/index.js +1 -39
  181. package/dist/weave/environment/issues.d.ts +0 -35
  182. package/dist/weave/environment/issues.js +0 -59
  183. package/dist/weave/git.d.ts +0 -8
  184. package/dist/weave/git.js +0 -8
  185. package/dist/weave/index.d.ts +0 -13
  186. package/dist/weave/index.js +2 -28
  187. package/dist/weave/knowledge/global.d.ts +0 -39
  188. package/dist/weave/knowledge/global.js +2 -78
  189. package/dist/weave/loop.js +0 -3
  190. package/dist/weave/orchestrator.d.ts +0 -69
  191. package/dist/weave/orchestrator.js +1 -101
  192. package/dist/weave/phase-manager.d.ts +0 -64
  193. package/dist/weave/phase-manager.js +0 -89
  194. package/dist/weave/security/secret-scan.d.ts +0 -14
  195. package/dist/weave/security/secret-scan.js +0 -19
  196. package/dist/weave/stages/build.js +0 -15
  197. package/dist/weave/stages/execute.d.ts +0 -42
  198. package/dist/weave/stages/execute.js +4 -86
  199. package/dist/weave/stages/handoff.d.ts +0 -7
  200. package/dist/weave/stages/handoff.js +0 -43
  201. package/dist/weave/stages/index.d.ts +0 -3
  202. package/dist/weave/stages/index.js +0 -3
  203. package/dist/weave/stages/intake.d.ts +0 -8
  204. package/dist/weave/stages/intake.js +5 -65
  205. package/dist/weave/stages/map.d.ts +0 -1
  206. package/dist/weave/stages/openspec.d.ts +0 -1
  207. package/dist/weave/stages/plan.d.ts +0 -11
  208. package/dist/weave/stages/plan.js +1 -53
  209. package/dist/weave/stages/refine.d.ts +0 -7
  210. package/dist/weave/stages/refine.js +0 -7
  211. package/dist/weave/stages/research.d.ts +0 -6
  212. package/dist/weave/stages/research.js +0 -6
  213. package/dist/weave/stages/spec.d.ts +0 -12
  214. package/dist/weave/stages/spec.js +0 -17
  215. package/dist/weave/types.d.ts +0 -20
  216. package/dist/weave/types.js +0 -5
  217. package/dist/weave/verification/commands.d.ts +0 -12
  218. package/dist/weave/verification/commands.js +0 -19
  219. package/dist/weave/verification/index.d.ts +0 -6
  220. package/dist/weave/verification/index.js +1 -19
  221. package/dist/weave/verification/playwright.d.ts +0 -47
  222. package/dist/weave/verification/playwright.js +1 -90
  223. package/dist/weave/worktree.d.ts +0 -16
  224. package/dist/weave/worktree.js +0 -23
  225. package/dist/weave/yaml-repair.d.ts +0 -39
  226. package/dist/weave/yaml-repair.js +13 -116
  227. package/package.json +1 -1
@@ -3,9 +3,6 @@ import * as path from "node:path";
3
3
  import * as os from "node:os";
4
4
  import { spawnSync } from "node:child_process";
5
5
  import { VERSION } from "../version.js";
6
- // ============================================================================
7
- // Constants
8
- // ============================================================================
9
6
  const MIN_OPENCODE_VERSION = "1.0.0";
10
7
  const PLUGIN_NAME = "maskweaver";
11
8
  const colors = {
@@ -18,9 +15,6 @@ const colors = {
18
15
  blue: "\x1b[34m",
19
16
  cyan: "\x1b[36m",
20
17
  };
21
- // ============================================================================
22
- // Utilities
23
- // ============================================================================
24
18
  function icon(status) {
25
19
  switch (status) {
26
20
  case "pass": return `${colors.green}✓${colors.reset}`;
@@ -56,9 +50,6 @@ function compareVersions(current, minimum) {
56
50
  }
57
51
  return true;
58
52
  }
59
- // ============================================================================
60
- // Checks
61
- // ============================================================================
62
53
  function checkOpenCodeVersion() {
63
54
  try {
64
55
  const result = spawnSync("opencode", ["--version"], {
@@ -107,7 +98,6 @@ function checkPluginRegistration() {
107
98
  const projectConfig = path.join(projectDir, "opencode.json");
108
99
  let foundIn = "";
109
100
  let legacyEntry = "";
110
- // Check global
111
101
  if (fs.existsSync(globalConfig)) {
112
102
  try {
113
103
  const config = JSON.parse(fs.readFileSync(globalConfig, "utf-8"));
@@ -120,9 +110,8 @@ function checkPluginRegistration() {
120
110
  }
121
111
  }
122
112
  }
123
- catch { /* ignore */ }
113
+ catch { }
124
114
  }
125
- // Check project
126
115
  if (!foundIn && fs.existsSync(projectConfig)) {
127
116
  try {
128
117
  const config = JSON.parse(fs.readFileSync(projectConfig, "utf-8"));
@@ -135,7 +124,7 @@ function checkPluginRegistration() {
135
124
  }
136
125
  }
137
126
  }
138
- catch { /* ignore */ }
127
+ catch { }
139
128
  }
140
129
  if (foundIn && legacyEntry) {
141
130
  return {
@@ -203,7 +192,7 @@ function checkMasksDirectory() {
203
192
  location = label;
204
193
  }
205
194
  }
206
- catch { /* ignore */ }
195
+ catch { }
207
196
  }
208
197
  }
209
198
  if (count > 0) {
@@ -230,7 +219,7 @@ function checkAgentFiles() {
230
219
  const files = fs.readdirSync(dir).filter((f) => f.endsWith(".md"));
231
220
  count += files.length;
232
221
  }
233
- catch { /* ignore */ }
222
+ catch { }
234
223
  }
235
224
  }
236
225
  if (count > 0) {
@@ -257,7 +246,7 @@ function checkCommandFiles() {
257
246
  const files = fs.readdirSync(dir).filter((f) => f.endsWith(".md"));
258
247
  count += files.length;
259
248
  }
260
- catch { /* ignore */ }
249
+ catch { }
261
250
  }
262
251
  }
263
252
  if (count > 0) {
@@ -276,7 +265,6 @@ function checkCommandFiles() {
276
265
  }
277
266
  function checkGdcIntegration() {
278
267
  const projectDir = getProjectDir();
279
- // Check for GDC-related files in .opencode
280
268
  const weaveDir = path.join(projectDir, "weave");
281
269
  if (fs.existsSync(weaveDir)) {
282
270
  return {
@@ -285,7 +273,6 @@ function checkGdcIntegration() {
285
273
  message: "weave/ 디렉토리 있음",
286
274
  };
287
275
  }
288
- // Check for AGENTS.md (used by /init-deep)
289
276
  const agentsMd = path.join(process.cwd(), "AGENTS.md");
290
277
  if (fs.existsSync(agentsMd)) {
291
278
  return {
@@ -301,9 +288,6 @@ function checkGdcIntegration() {
301
288
  hint: "/weave init 으로 초기화하세요",
302
289
  };
303
290
  }
304
- // ============================================================================
305
- // Doctor Command
306
- // ============================================================================
307
291
  export function runDoctor() {
308
292
  const results = [
309
293
  checkOpenCodeVersion(),
@@ -1,10 +1,2 @@
1
1
  #!/usr/bin/env node
2
- /**
3
- * Maskweaver CLI Installer
4
- *
5
- * Commands:
6
- * - maskweaver install - Register plugin in opencode.json
7
- * - maskweaver uninstall - Remove plugin from opencode.json
8
- * - maskweaver status - Show current installation status
9
- */
10
2
  export {};
@@ -1,12 +1,4 @@
1
1
  #!/usr/bin/env node
2
- /**
3
- * Maskweaver CLI Installer
4
- *
5
- * Commands:
6
- * - maskweaver install - Register plugin in opencode.json
7
- * - maskweaver uninstall - Remove plugin from opencode.json
8
- * - maskweaver status - Show current installation status
9
- */
10
2
  import { Command } from "commander";
11
3
  import * as fs from "node:fs";
12
4
  import * as path from "node:path";
@@ -14,14 +6,10 @@ import * as os from "node:os";
14
6
  import { VERSION } from "../version.js";
15
7
  import { runDoctor, printDoctorReport } from "./doctor.js";
16
8
  import { writeDefaultRuntimeConfig, writeDefaultPluginConfig } from "../shared/generate-agents.js";
17
- // ============================================================================
18
- // Constants
19
- // ============================================================================
20
9
  const PLUGIN_NAME = "maskweaver";
21
10
  const LEGACY_PLUGIN_NAMES = ["maskweaver/plugin", "@maskweaver/plugin"];
22
11
  const ALL_PLUGIN_NAMES = [PLUGIN_NAME, ...LEGACY_PLUGIN_NAMES];
23
12
  const CONFIG_NAME = "opencode.json";
24
- // ANSI Colors
25
13
  const colors = {
26
14
  reset: "\x1b[0m",
27
15
  bright: "\x1b[1m",
@@ -34,9 +22,6 @@ const colors = {
34
22
  cyan: "\x1b[36m",
35
23
  white: "\x1b[37m",
36
24
  };
37
- // ============================================================================
38
- // Utilities
39
- // ============================================================================
40
25
  function log(message, color) {
41
26
  const colorCode = color ? colors[color] : "";
42
27
  console.log(`${colorCode}${message}${colors.reset}`);
@@ -112,9 +97,6 @@ function normalizePluginEntries(config) {
112
97
  config.plugin = [...preserved, PLUGIN_NAME];
113
98
  return { migratedFrom, changed: true };
114
99
  }
115
- // ============================================================================
116
- // Commands
117
- // ============================================================================
118
100
  async function installPlugin(options) {
119
101
  const isLocal = options.local || false;
120
102
  const configPath = getConfigPath(isLocal);
@@ -126,9 +108,7 @@ async function installPlugin(options) {
126
108
  info(`설정 파일: ${configPath}`);
127
109
  log("");
128
110
  try {
129
- // Read or create config
130
111
  let config = readConfig(configPath);
131
- // Initialize plugin array if not exists
132
112
  if (!config.plugin) {
133
113
  config.plugin = [];
134
114
  }
@@ -140,20 +120,16 @@ async function installPlugin(options) {
140
120
  log("");
141
121
  return;
142
122
  }
143
- // Check if already installed
144
123
  if (config.plugin.includes(PLUGIN_NAME)) {
145
124
  warning(`플러그인이 이미 설치되어 있습니다.`);
146
125
  info(`현재 ${scope} 설정에 등록되어 있습니다: ${PLUGIN_NAME}`);
147
126
  log("");
148
127
  return;
149
128
  }
150
- // Add plugin
151
129
  config.plugin.push(PLUGIN_NAME);
152
- // Save config
153
130
  writeConfig(configPath, config);
154
131
  let createdRuntimeConfig = false;
155
132
  let createdPluginConfig = false;
156
- // Auto-create local maskweaver.config.json if not exists
157
133
  if (isLocal) {
158
134
  const runtimeCreated = writeDefaultRuntimeConfig(process.cwd());
159
135
  if (runtimeCreated) {
@@ -202,7 +178,6 @@ async function uninstallPlugin(options) {
202
178
  info(`설정 파일: ${configPath}`);
203
179
  log("");
204
180
  try {
205
- // Read config
206
181
  if (!fs.existsSync(configPath)) {
207
182
  warning(`설정 파일이 존재하지 않습니다.`);
208
183
  info(`플러그인이 설치되어 있지 않습니다.`);
@@ -210,19 +185,15 @@ async function uninstallPlugin(options) {
210
185
  return;
211
186
  }
212
187
  let config = readConfig(configPath);
213
- // Check if installed
214
188
  if (!isPluginInstalled(config)) {
215
189
  warning(`플러그인이 설치되어 있지 않습니다.`);
216
190
  log("");
217
191
  return;
218
192
  }
219
- // Remove plugin
220
193
  config.plugin = config.plugin.filter((p) => !ALL_PLUGIN_NAMES.includes(p));
221
- // Save config
222
194
  writeConfig(configPath, config);
223
195
  success(`플러그인이 성공적으로 제거되었습니다.`);
224
196
  log("");
225
- // Cleanup notice
226
197
  log(`📋 정리 안내`, "bright");
227
198
  log(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`, "dim");
228
199
  log("");
@@ -258,7 +229,6 @@ async function showStatus(options) {
258
229
  log(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`, "dim");
259
230
  log("");
260
231
  try {
261
- // Check global installation
262
232
  const globalPath = getConfigPath(false);
263
233
  const globalConfig = readConfig(globalPath);
264
234
  const globalInstalled = isPluginInstalled(globalConfig);
@@ -272,7 +242,6 @@ async function showStatus(options) {
272
242
  log(` ❌ 미설치`, "dim");
273
243
  }
274
244
  log("");
275
- // Check local installation
276
245
  const localPath = getConfigPath(true);
277
246
  const localConfig = fs.existsSync(localPath) ? readConfig(localPath) : {};
278
247
  const localInstalled = isPluginInstalled(localConfig);
@@ -286,7 +255,6 @@ async function showStatus(options) {
286
255
  log(` ❌ 미설치`, "dim");
287
256
  }
288
257
  log("");
289
- // Show plugin info
290
258
  if (globalInstalled || localInstalled) {
291
259
  log(`ℹ️ 플러그인 정보:`, "cyan");
292
260
  log(` 이름: ${PLUGIN_NAME}`, "dim");
@@ -299,7 +267,6 @@ async function showStatus(options) {
299
267
  }
300
268
  log("");
301
269
  }
302
- // Installation hint
303
270
  if (!globalInstalled && !localInstalled) {
304
271
  log(`설치하려면:`, "yellow");
305
272
  log(` maskweaver install # 전역 설치`, "dim");
@@ -313,9 +280,6 @@ async function showStatus(options) {
313
280
  process.exit(1);
314
281
  }
315
282
  }
316
- // ============================================================================
317
- // CLI Program
318
- // ============================================================================
319
283
  const program = new Command();
320
284
  program
321
285
  .name("maskweaver")
@@ -355,13 +319,10 @@ program
355
319
  printDoctorReport(report);
356
320
  process.exit(report.failed > 0 ? 1 : 0);
357
321
  });
358
- // Default action: show help
359
322
  program.action(() => {
360
323
  program.help();
361
324
  });
362
- // Parse command line arguments
363
325
  program.parse(process.argv);
364
- // Show help if no command provided
365
326
  if (!process.argv.slice(2).length) {
366
327
  program.help();
367
328
  }
@@ -1,10 +1,3 @@
1
- /**
2
- * Context Configuration
3
- *
4
- * 컨텍스트 시스템의 설정과 경로 유틸리티
5
- *
6
- * "Configuration should be obvious and in one place" - Kent Beck
7
- */
8
1
  export declare const CONTEXT_CONFIG: {
9
2
  readonly paths: {
10
3
  readonly contextDir: ".opencode/context";
@@ -15,23 +8,8 @@ export declare const CONTEXT_CONFIG: {
15
8
  readonly status: "active";
16
9
  };
17
10
  };
18
- /**
19
- * 컨텍스트 디렉토리 경로 반환
20
- */
21
11
  export declare function getContextDir(basePath: string): string;
22
- /**
23
- * 프로젝트 컨텍스트 파일 경로 반환
24
- */
25
12
  export declare function getProjectPath(basePath: string): string;
26
- /**
27
- * 피처 디렉토리 경로 반환
28
- */
29
13
  export declare function getFeaturesDir(basePath: string): string;
30
- /**
31
- * 특정 피처 파일 경로 반환
32
- */
33
14
  export declare function getFeaturePath(basePath: string, id: string): string;
34
- /**
35
- * 설정 내보내기 (외부 모듈에서 참조용)
36
- */
37
15
  export declare function getContextConfig(): typeof CONTEXT_CONFIG;
@@ -1,14 +1,4 @@
1
- /**
2
- * Context Configuration
3
- *
4
- * 컨텍스트 시스템의 설정과 경로 유틸리티
5
- *
6
- * "Configuration should be obvious and in one place" - Kent Beck
7
- */
8
1
  import { join } from 'path';
9
- // ============================================================================
10
- // Configuration
11
- // ============================================================================
12
2
  export const CONTEXT_CONFIG = {
13
3
  paths: {
14
4
  contextDir: '.opencode/context',
@@ -19,36 +9,18 @@ export const CONTEXT_CONFIG = {
19
9
  status: 'active',
20
10
  },
21
11
  };
22
- // ============================================================================
23
- // Path Utilities
24
- // ============================================================================
25
- /**
26
- * 컨텍스트 디렉토리 경로 반환
27
- */
28
12
  export function getContextDir(basePath) {
29
13
  return join(basePath, CONTEXT_CONFIG.paths.contextDir);
30
14
  }
31
- /**
32
- * 프로젝트 컨텍스트 파일 경로 반환
33
- */
34
15
  export function getProjectPath(basePath) {
35
16
  return join(getContextDir(basePath), CONTEXT_CONFIG.paths.projectFile);
36
17
  }
37
- /**
38
- * 피처 디렉토리 경로 반환
39
- */
40
18
  export function getFeaturesDir(basePath) {
41
19
  return join(getContextDir(basePath), CONTEXT_CONFIG.paths.featuresDir);
42
20
  }
43
- /**
44
- * 특정 피처 파일 경로 반환
45
- */
46
21
  export function getFeaturePath(basePath, id) {
47
22
  return join(getFeaturesDir(basePath), `${id}.json`);
48
23
  }
49
- /**
50
- * 설정 내보내기 (외부 모듈에서 참조용)
51
- */
52
24
  export function getContextConfig() {
53
25
  return CONTEXT_CONFIG;
54
26
  }
@@ -1,48 +1,9 @@
1
- /**
2
- * Feature Management
3
- *
4
- * 피처의 생성, 조회, 업데이트, 목록, 전환, 완료, 삭제
5
- *
6
- * "Keep functions small and focused" - Kent Beck
7
- */
8
1
  import type { FeatureContext, FeatureUpdate, Result } from './types.js';
9
- /**
10
- * 새로운 피처를 생성합니다.
11
- */
12
2
  export declare function createFeature(basePath: string, name: string, goal: string): Promise<Result<FeatureContext>>;
13
- /**
14
- * 특정 피처를 조회합니다.
15
- */
16
3
  export declare function getFeature(basePath: string, id: string): Promise<Result<FeatureContext>>;
17
- /**
18
- * 피처를 업데이트합니다.
19
- */
20
4
  export declare function updateFeature(basePath: string, id: string, updates: FeatureUpdate): Promise<Result<FeatureContext>>;
21
- /**
22
- * 모든 피처 목록을 반환합니다.
23
- */
24
5
  export declare function listFeatures(basePath: string): Promise<Result<FeatureContext[]>>;
25
- /**
26
- * 활성 피처를 전환합니다.
27
- *
28
- * 프로젝트 컨텍스트의 activeFeatureId를 업데이트하고,
29
- * 해당 피처의 상태를 'active'로 변경합니다.
30
- */
31
6
  export declare function switchFeature(basePath: string, id: string): Promise<Result<FeatureContext>>;
32
- /**
33
- * 피처를 완료 처리합니다.
34
- *
35
- * - 상태를 'completed'로 변경
36
- * - activeFeatureId에서 제거
37
- */
38
7
  export declare function completeFeature(basePath: string, id: string): Promise<Result<FeatureContext>>;
39
- /**
40
- * 피처를 삭제합니다.
41
- *
42
- * 주의: 이 작업은 되돌릴 수 없습니다.
43
- */
44
8
  export declare function deleteFeature(basePath: string, id: string): Promise<Result<void>>;
45
- /**
46
- * 현재 활성 피처를 조회합니다.
47
- */
48
9
  export declare function getActiveFeature(basePath: string): Promise<Result<FeatureContext | null>>;
@@ -1,32 +1,17 @@
1
- /**
2
- * Feature Management
3
- *
4
- * 피처의 생성, 조회, 업데이트, 목록, 전환, 완료, 삭제
5
- *
6
- * "Keep functions small and focused" - Kent Beck
7
- */
8
1
  import { randomUUID } from 'crypto';
9
2
  import { readFile, writeFile, readdir, unlink } from 'fs/promises';
10
3
  import { existsSync } from 'fs';
11
4
  import { CONTEXT_CONFIG, getFeaturePath, getFeaturesDir } from './config.js';
12
5
  import { now, errorMessage } from './utils.js';
13
6
  import { getProjectContext, saveProjectContext, initContextDir } from './project.js';
14
- // ============================================================================
15
- // Create Feature
16
- // ============================================================================
17
- /**
18
- * 새로운 피처를 생성합니다.
19
- */
20
7
  export async function createFeature(basePath, name, goal) {
21
8
  try {
22
- // 입력 검증
23
9
  if (!name || name.trim().length === 0) {
24
10
  return { success: false, error: '[Context] Feature name is required' };
25
11
  }
26
12
  if (!goal || goal.trim().length === 0) {
27
13
  return { success: false, error: '[Context] Feature goal is required' };
28
14
  }
29
- // 디렉토리 확인/초기화
30
15
  if (!existsSync(getFeaturesDir(basePath))) {
31
16
  const initResult = await initContextDir(basePath);
32
17
  if (!initResult.success) {
@@ -55,12 +40,6 @@ export async function createFeature(basePath, name, goal) {
55
40
  };
56
41
  }
57
42
  }
58
- // ============================================================================
59
- // Read Feature
60
- // ============================================================================
61
- /**
62
- * 특정 피처를 조회합니다.
63
- */
64
43
  export async function getFeature(basePath, id) {
65
44
  try {
66
45
  const featurePath = getFeaturePath(basePath, id);
@@ -81,20 +60,12 @@ export async function getFeature(basePath, id) {
81
60
  };
82
61
  }
83
62
  }
84
- // ============================================================================
85
- // Update Feature
86
- // ============================================================================
87
- /**
88
- * 피처를 업데이트합니다.
89
- */
90
63
  export async function updateFeature(basePath, id, updates) {
91
64
  try {
92
- // 기존 피처 조회
93
65
  const existing = await getFeature(basePath, id);
94
66
  if (!existing.success || !existing.data) {
95
67
  return existing;
96
68
  }
97
- // 업데이트 적용 (id와 createdAt은 불변)
98
69
  const updated = {
99
70
  ...existing.data,
100
71
  ...updates,
@@ -113,12 +84,6 @@ export async function updateFeature(basePath, id, updates) {
113
84
  };
114
85
  }
115
86
  }
116
- // ============================================================================
117
- // List Features
118
- // ============================================================================
119
- /**
120
- * 모든 피처 목록을 반환합니다.
121
- */
122
87
  export async function listFeatures(basePath) {
123
88
  try {
124
89
  const featuresDir = getFeaturesDir(basePath);
@@ -135,7 +100,6 @@ export async function listFeatures(basePath) {
135
100
  features.push(result.data);
136
101
  }
137
102
  }
138
- // 최신 업데이트 순으로 정렬
139
103
  features.sort((a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime());
140
104
  return { success: true, data: features };
141
105
  }
@@ -146,44 +110,29 @@ export async function listFeatures(basePath) {
146
110
  };
147
111
  }
148
112
  }
149
- // ============================================================================
150
- // Switch Feature
151
- // ============================================================================
152
- /**
153
- * 활성 피처를 전환합니다.
154
- *
155
- * 프로젝트 컨텍스트의 activeFeatureId를 업데이트하고,
156
- * 해당 피처의 상태를 'active'로 변경합니다.
157
- */
158
113
  export async function switchFeature(basePath, id) {
159
114
  try {
160
- // 피처 존재 확인
161
115
  const feature = await getFeature(basePath, id);
162
116
  if (!feature.success || !feature.data) {
163
117
  return feature;
164
118
  }
165
- // 이미 completed인 피처는 전환 불가
166
119
  if (feature.data.status === 'completed') {
167
120
  return {
168
121
  success: false,
169
122
  error: '[Context] Cannot switch to completed feature. Reopen it first.',
170
123
  };
171
124
  }
172
- // 프로젝트 컨텍스트 업데이트
173
125
  const projectResult = await getProjectContext(basePath);
174
126
  const project = projectResult.success && projectResult.data
175
127
  ? projectResult.data
176
128
  : { name: 'unnamed' };
177
- // 이전 활성 피처를 paused로 변경
178
129
  if (project.activeFeatureId && project.activeFeatureId !== id) {
179
130
  await updateFeature(basePath, project.activeFeatureId, { status: 'paused' });
180
131
  }
181
- // 현재 피처를 active로 변경
182
132
  const updated = await updateFeature(basePath, id, { status: 'active' });
183
133
  if (!updated.success) {
184
134
  return updated;
185
135
  }
186
- // 프로젝트 컨텍스트에 activeFeatureId 저장
187
136
  project.activeFeatureId = id;
188
137
  await saveProjectContext(basePath, project);
189
138
  return updated;
@@ -195,23 +144,12 @@ export async function switchFeature(basePath, id) {
195
144
  };
196
145
  }
197
146
  }
198
- // ============================================================================
199
- // Complete Feature
200
- // ============================================================================
201
- /**
202
- * 피처를 완료 처리합니다.
203
- *
204
- * - 상태를 'completed'로 변경
205
- * - activeFeatureId에서 제거
206
- */
207
147
  export async function completeFeature(basePath, id) {
208
148
  try {
209
- // 피처 상태 변경
210
149
  const updated = await updateFeature(basePath, id, { status: 'completed' });
211
150
  if (!updated.success) {
212
151
  return updated;
213
152
  }
214
- // 프로젝트 컨텍스트에서 activeFeatureId 제거 (해당 피처인 경우)
215
153
  const projectResult = await getProjectContext(basePath);
216
154
  if (projectResult.success && projectResult.data) {
217
155
  if (projectResult.data.activeFeatureId === id) {
@@ -228,14 +166,6 @@ export async function completeFeature(basePath, id) {
228
166
  };
229
167
  }
230
168
  }
231
- // ============================================================================
232
- // Delete Feature
233
- // ============================================================================
234
- /**
235
- * 피처를 삭제합니다.
236
- *
237
- * 주의: 이 작업은 되돌릴 수 없습니다.
238
- */
239
169
  export async function deleteFeature(basePath, id) {
240
170
  try {
241
171
  const featurePath = getFeaturePath(basePath, id);
@@ -245,7 +175,6 @@ export async function deleteFeature(basePath, id) {
245
175
  error: `[Context] Feature not found: ${id}`,
246
176
  };
247
177
  }
248
- // 활성 피처인 경우 프로젝트 컨텍스트에서 제거
249
178
  const projectResult = await getProjectContext(basePath);
250
179
  if (projectResult.success && projectResult.data) {
251
180
  if (projectResult.data.activeFeatureId === id) {
@@ -263,12 +192,6 @@ export async function deleteFeature(basePath, id) {
263
192
  };
264
193
  }
265
194
  }
266
- // ============================================================================
267
- // Get Active Feature
268
- // ============================================================================
269
- /**
270
- * 현재 활성 피처를 조회합니다.
271
- */
272
195
  export async function getActiveFeature(basePath) {
273
196
  try {
274
197
  const projectResult = await getProjectContext(basePath);
@@ -1,16 +1,3 @@
1
- /**
2
- * Feature File Management
3
- *
4
- * 피처에 파일 추가/제거
5
- *
6
- * "Simple operations, clearly named" - Kent Beck
7
- */
8
1
  import type { FeatureContext, Result } from './types.js';
9
- /**
10
- * 피처에 파일을 추가합니다.
11
- */
12
2
  export declare function addFileToFeature(basePath: string, id: string, filePath: string): Promise<Result<FeatureContext>>;
13
- /**
14
- * 피처에서 파일을 제거합니다.
15
- */
16
3
  export declare function removeFileFromFeature(basePath: string, id: string, filePath: string): Promise<Result<FeatureContext>>;
@@ -1,47 +1,24 @@
1
- /**
2
- * Feature File Management
3
- *
4
- * 피처에 파일 추가/제거
5
- *
6
- * "Simple operations, clearly named" - Kent Beck
7
- */
8
1
  import { normalizePath } from './utils.js';
9
2
  import { getFeature, updateFeature } from './feature.js';
10
- // ============================================================================
11
- // Add File
12
- // ============================================================================
13
- /**
14
- * 피처에 파일을 추가합니다.
15
- */
16
3
  export async function addFileToFeature(basePath, id, filePath) {
17
4
  const feature = await getFeature(basePath, id);
18
5
  if (!feature.success || !feature.data) {
19
6
  return feature;
20
7
  }
21
- // 정규화된 경로
22
8
  const normalizedPath = normalizePath(filePath);
23
- // 중복 체크
24
9
  if (feature.data.files.includes(normalizedPath)) {
25
- return { success: true, data: feature.data }; // 이미 있으면 그냥 성공
10
+ return { success: true, data: feature.data };
26
11
  }
27
12
  const updatedFiles = [...feature.data.files, normalizedPath];
28
13
  return updateFeature(basePath, id, { files: updatedFiles });
29
14
  }
30
- // ============================================================================
31
- // Remove File
32
- // ============================================================================
33
- /**
34
- * 피처에서 파일을 제거합니다.
35
- */
36
15
  export async function removeFileFromFeature(basePath, id, filePath) {
37
16
  const feature = await getFeature(basePath, id);
38
17
  if (!feature.success || !feature.data) {
39
18
  return feature;
40
19
  }
41
- // 정규화된 경로
42
20
  const normalizedPath = normalizePath(filePath);
43
21
  const updatedFiles = feature.data.files.filter(f => f !== normalizedPath);
44
- // 변경이 없으면 그냥 성공
45
22
  if (updatedFiles.length === feature.data.files.length) {
46
23
  return { success: true, data: feature.data };
47
24
  }
@@ -1,10 +1,3 @@
1
- /**
2
- * Context Package
3
- *
4
- * 피처 기반 컨텍스트 관리 시스템
5
- *
6
- * "Export only what's needed" - Kent Beck
7
- */
8
1
  export type { FeatureContext, ProjectContext, FeatureUpdate, Result, } from './types.js';
9
2
  export { CONTEXT_CONFIG, getContextDir, getProjectPath, getFeaturesDir, getFeaturePath, getContextConfig, } from './config.js';
10
3
  export { getProjectContext, saveProjectContext, initContextDir, } from './project.js';