maskweaver 0.11.0 → 0.11.2

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 (43) hide show
  1. package/LICENSE +21 -21
  2. package/README.ko.md +640 -640
  3. package/README.md +672 -672
  4. package/assets/agents/dummy-human.md +31 -31
  5. package/assets/agents/dummy-template.md +57 -57
  6. package/assets/agents/mask-weaver.md +412 -412
  7. package/assets/agents/squad-operator.md +242 -242
  8. package/assets/masks/ai-ml/andrew-ng.yaml +207 -207
  9. package/assets/masks/architecture/jeff-dean.yaml +208 -208
  10. package/assets/masks/index.json +65 -65
  11. package/assets/masks/software-engineering/dan-abramov.yaml +188 -188
  12. package/assets/masks/software-engineering/kent-beck.yaml +191 -191
  13. package/assets/masks/software-engineering/linus-torvalds.yaml +152 -152
  14. package/assets/masks/software-engineering/martin-fowler.yaml +173 -173
  15. package/dist/memory/store/sqlite.js +102 -102
  16. package/dist/plugin/tools/context.js +15 -15
  17. package/dist/plugin/tools/maskSave.js +8 -8
  18. package/dist/plugin/tools/memoryIndexer.js +5 -5
  19. package/dist/plugin/tools/memorySearch.js +8 -8
  20. package/dist/plugin/tools/memoryWrite.js +3 -3
  21. package/dist/plugin/tools/retrospect.js +3 -3
  22. package/dist/plugin/tools/squad.js +39 -39
  23. package/dist/retrospect/mask-save.js +21 -21
  24. package/dist/retrospect/retrospect.js +9 -9
  25. package/dist/shared/generate-agents.d.ts +3 -15
  26. package/dist/shared/generate-agents.js +13 -172
  27. package/dist/shared/subscription-detection.d.ts +20 -0
  28. package/dist/shared/subscription-detection.js +162 -0
  29. package/dist/verify/prompts.js +114 -114
  30. package/dist/version.d.ts +1 -1
  31. package/dist/version.js +1 -1
  32. package/dist/weave/knowledge/global.js +86 -86
  33. package/dist/weave/verification/playwright.js +127 -127
  34. package/masks/ai-ml/andrew-ng.yaml +207 -207
  35. package/masks/architecture/jeff-dean.yaml +208 -208
  36. package/masks/index.json +65 -65
  37. package/masks/orchestration/squad-operator.yaml +205 -205
  38. package/masks/software-engineering/dan-abramov.yaml +188 -188
  39. package/masks/software-engineering/kent-beck.yaml +191 -191
  40. package/masks/software-engineering/linus-torvalds.yaml +152 -152
  41. package/masks/software-engineering/martin-fowler.yaml +173 -173
  42. package/package.json +1 -1
  43. package/postinstall.mjs +22 -112
package/postinstall.mjs CHANGED
@@ -1,66 +1,11 @@
1
1
  // postinstall.mjs
2
- // Runs after npm install to verify OpenCode compatibility
2
+ // Runs after npm install to create/migrate Maskweaver config.
3
3
 
4
- import { spawnSync } from "node:child_process";
5
4
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
6
5
  import { homedir } from "node:os";
7
6
  import { join } from "node:path";
8
7
  import { fileURLToPath } from "node:url";
9
8
 
10
- const MIN_OPENCODE_VERSION = "1.0.0";
11
-
12
- /**
13
- * Parse version string into numeric parts
14
- */
15
- function parseVersion(version) {
16
- return version
17
- .replace(/^v/, "")
18
- .split("-")[0]
19
- .split(".")
20
- .map((part) => Number.parseInt(part, 10) || 0);
21
- }
22
-
23
- /**
24
- * Compare two version strings
25
- */
26
- function compareVersions(current, minimum) {
27
- const currentParts = parseVersion(current);
28
- const minimumParts = parseVersion(minimum);
29
- const length = Math.max(currentParts.length, minimumParts.length);
30
-
31
- for (let index = 0; index < length; index++) {
32
- const currentPart = currentParts[index] ?? 0;
33
- const minimumPart = minimumParts[index] ?? 0;
34
- if (currentPart > minimumPart) return true;
35
- if (currentPart < minimumPart) return false;
36
- }
37
-
38
- return true;
39
- }
40
-
41
- /**
42
- * Check if opencode version meets minimum requirement
43
- */
44
- function checkOpenCodeVersion() {
45
- try {
46
- const result = spawnSync("opencode", ["--version"], {
47
- encoding: "utf-8",
48
- stdio: ["pipe", "pipe", "ignore"],
49
- timeout: 5000,
50
- });
51
-
52
- if (result.error) {
53
- return { ok: null, version: null };
54
- }
55
-
56
- const version = result.stdout.trim();
57
- const ok = compareVersions(version, MIN_OPENCODE_VERSION);
58
- return { ok, version };
59
- } catch {
60
- return { ok: null, version: null };
61
- }
62
- }
63
-
64
9
  function getPackageVersion() {
65
10
  try {
66
11
  const dir = fileURLToPath(new URL(".", import.meta.url));
@@ -149,42 +94,16 @@ const OPENCODE_GO_POOL = [
149
94
  },
150
95
  ];
151
96
 
152
- function runCli(command, args) {
153
- try {
154
- const result = spawnSync(command, args, {
155
- encoding: 'utf-8',
156
- stdio: ['pipe', 'pipe', 'pipe'],
157
- timeout: 8000,
158
- windowsHide: true,
159
- });
160
- if (result.error || result.status !== 0) return null;
161
- return result.stdout || null;
162
- } catch {
163
- return null;
164
- }
165
- }
166
-
167
97
  function detectSubscription() {
168
98
  let hasOpencodeGo = false;
169
99
  let hasZai = false;
170
100
 
171
- const providersOutput = runCli('opencode', ['providers', 'list']);
172
- if (providersOutput) {
173
- const stripped = providersOutput.replace(/\x1b\[[0-9;]*m/g, '');
174
- if (/opencode\s*go/i.test(stripped)) hasOpencodeGo = true;
175
- if (/z\.ai\s*coding\s*plan|zai-coding-plan/i.test(stripped)) hasZai = true;
176
- }
177
-
178
- const modelsOutput = runCli('opencode', ['models']);
179
- if (modelsOutput) {
180
- if (/^opencode-go\//m.test(modelsOutput)) hasOpencodeGo = true;
181
- if (/^zai-coding-plan\//m.test(modelsOutput)) hasZai = true;
182
- }
183
-
184
- if (hasZai) return 'zai-coding-plan';
185
- if (hasOpencodeGo) return 'opencode-go';
186
-
101
+ const initCwd = process.env.INIT_CWD;
187
102
  const candidates = [
103
+ ...(initCwd ? [
104
+ join(initCwd, 'opencode.json'),
105
+ join(initCwd, 'opencode.jsonc'),
106
+ ] : []),
188
107
  join(homedir(), '.config', 'opencode', 'opencode.json'),
189
108
  join(homedir(), '.config', 'opencode', 'opencode.jsonc'),
190
109
  ];
@@ -198,11 +117,20 @@ function detectSubscription() {
198
117
  if (!parsed || typeof parsed !== 'object') continue;
199
118
 
200
119
  const modelFields = ['model', 'small_model', 'large_model'];
201
- for (const field of modelFields) {
202
- const val = parsed[field];
203
- if (typeof val !== 'string' || !val) continue;
204
- if (val.startsWith('opencode-go/')) hasOpencodeGo = true;
205
- if (val.startsWith('zai-coding-plan/')) hasZai = true;
120
+ const configs = [parsed];
121
+ if (parsed.agent && typeof parsed.agent === 'object') {
122
+ for (const agentConfig of Object.values(parsed.agent)) {
123
+ if (agentConfig && typeof agentConfig === 'object') configs.push(agentConfig);
124
+ }
125
+ }
126
+
127
+ for (const cfg of configs) {
128
+ for (const field of modelFields) {
129
+ const val = cfg[field];
130
+ if (typeof val !== 'string' || !val) continue;
131
+ if (val.startsWith('opencode-go/')) hasOpencodeGo = true;
132
+ if (val.startsWith('zai-coding-plan/')) hasZai = true;
133
+ }
206
134
  }
207
135
  } catch { continue; }
208
136
  }
@@ -316,26 +244,8 @@ function main() {
316
244
  console.log('');
317
245
  }
318
246
 
319
- const versionCheck = checkOpenCodeVersion();
320
-
321
- if (versionCheck.ok === null) {
322
- console.log(`⚠ maskweaver v${pkgVersion}: OpenCode를 감지할 수 없습니다.`);
323
- console.log(` OpenCode가 설치되어 있지 않다면 https://opencode.ai/docs 를 참조하세요.`);
324
- console.log(` maskweaver는 OpenCode 플러그인으로 동작합니다.`);
325
- return;
326
- }
327
-
328
- if (!versionCheck.ok) {
329
- console.warn(`⚠ maskweaver v${pkgVersion}: OpenCode >= ${MIN_OPENCODE_VERSION} 이 필요합니다.`);
330
- console.warn(` 감지된 버전: ${versionCheck.version}`);
331
- console.warn(` 최신 버전으로 업데이트하세요: opencode --upgrade`);
332
- return;
333
- }
334
-
335
- if (versionCheck.version) {
336
- console.log(`✓ maskweaver v${pkgVersion}: OpenCode ${versionCheck.version} 호환됨`);
337
- }
338
-
247
+ console.log(`✓ maskweaver v${pkgVersion}: 설치 후 설정 점검 완료`);
248
+ console.log(` OpenCode 호환성은 플러그인 로드 시 확인됩니다.`);
339
249
  console.log(` maskweaver install 로 플러그인을 등록하세요.`);
340
250
  }
341
251