maskweaver 0.9.8 → 0.9.9

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.
@@ -594,7 +594,73 @@ function playCompletionSound(config) {
594
594
  }
595
595
  }
596
596
  let state = null;
597
+ const OPENCODE_PACKAGES_DIR = path.join(os.homedir(), '.cache', 'opencode', 'packages');
598
+ const MASKWEAVER_PACKAGE_GLOB = 'maskweaver@*';
599
+ function getCacheVersion() {
600
+ if (!fs.existsSync(OPENCODE_PACKAGES_DIR))
601
+ return null;
602
+ const entries = fs.readdirSync(OPENCODE_PACKAGES_DIR);
603
+ for (const entry of entries) {
604
+ if (!entry.startsWith('maskweaver@'))
605
+ continue;
606
+ const pkgDir = path.join(OPENCODE_PACKAGES_DIR, entry, 'node_modules', 'maskweaver');
607
+ const pkgJsonPath = path.join(pkgDir, 'package.json');
608
+ if (!fs.existsSync(pkgJsonPath))
609
+ continue;
610
+ try {
611
+ const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8'));
612
+ return { version: pkg.version, pkgDir: path.join(OPENCODE_PACKAGES_DIR, entry) };
613
+ }
614
+ catch {
615
+ continue;
616
+ }
617
+ }
618
+ return null;
619
+ }
620
+ function getLatestNpmVersion() {
621
+ try {
622
+ const result = spawnSync('npm', ['view', 'maskweaver', 'version'], {
623
+ encoding: 'utf-8',
624
+ stdio: ['pipe', 'pipe', 'pipe'],
625
+ timeout: 10000,
626
+ windowsHide: true,
627
+ });
628
+ if (result.status === 0 && result.stdout) {
629
+ return result.stdout.trim();
630
+ }
631
+ }
632
+ catch { }
633
+ return null;
634
+ }
635
+ function checkAndInvalidateCache() {
636
+ const cached = getCacheVersion();
637
+ if (!cached) {
638
+ return { invalidated: false, cachedVersion: null, latestVersion: null };
639
+ }
640
+ if (cached.version === VERSION) {
641
+ return { invalidated: false, cachedVersion: cached.version, latestVersion: null };
642
+ }
643
+ const latest = getLatestNpmVersion();
644
+ if (latest && latest !== cached.version) {
645
+ try {
646
+ fs.rmSync(cached.pkgDir, { recursive: true, force: true });
647
+ return { invalidated: true, cachedVersion: cached.version, latestVersion: latest };
648
+ }
649
+ catch {
650
+ return { invalidated: false, cachedVersion: cached.version, latestVersion: latest };
651
+ }
652
+ }
653
+ return { invalidated: false, cachedVersion: cached.version, latestVersion: latest };
654
+ }
597
655
  export const MaskweaverPlugin = async ({ client, directory, project, worktree, $, serverUrl }) => {
656
+ const cacheCheck = checkAndInvalidateCache();
657
+ if (cacheCheck.invalidated) {
658
+ pluginLog(client, 'warn', `Stale plugin cache detected (v${cacheCheck.cachedVersion}). Cleared — v${cacheCheck.latestVersion} will install on next restart.`);
659
+ pluginLog(client, 'warn', `Please restart OpenCode to activate maskweaver v${VERSION}.`);
660
+ }
661
+ else if (cacheCheck.cachedVersion && cacheCheck.cachedVersion !== VERSION) {
662
+ pluginLog(client, 'info', `Plugin cache v${cacheCheck.cachedVersion} — current is v${VERSION}. Restart recommended.`);
663
+ }
598
664
  const pluginConfig = loadPluginConfig(directory, { client, verbose: false });
599
665
  const configErrors = validateConfig(pluginConfig);
600
666
  if (configErrors.length > 0) {
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.9.8";
1
+ export declare const VERSION = "0.9.9";
2
2
  export declare function getVersionString(): string;
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
- export const VERSION = '0.9.8';
1
+ export const VERSION = '0.9.9';
2
2
  export function getVersionString() {
3
3
  return `Maskweaver v${VERSION}`;
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maskweaver",
3
- "version": "0.9.8",
3
+ "version": "0.9.9",
4
4
  "description": "AI Expert Persona System - Give your AI coding assistant expert personalities (가면술사)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",