@super-pocock-ai/suite 2.0.10 → 2.0.13

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 (2) hide show
  1. package/index.js +58 -1
  2. package/package.json +5 -5
package/index.js CHANGED
@@ -3,7 +3,8 @@ import { join, dirname } from 'path'
3
3
  import { fileURLToPath } from 'url'
4
4
  import { execSync } from 'child_process'
5
5
 
6
- const SUITE_VERSION = '2.0.9'
6
+ const __dirname = dirname(fileURLToPath(import.meta.url))
7
+ const SUITE_VERSION = JSON.parse(readFileSync(join(__dirname, 'package.json'), 'utf-8')).version
7
8
 
8
9
  export const SuperPocockSuite = async ({ project, client, $, directory, worktree }) => {
9
10
  const agentsDir = join(process.env.HOME, '.config', 'opencode', 'agents')
@@ -36,6 +37,62 @@ export const SuperPocockSuite = async ({ project, client, $, directory, worktree
36
37
  }
37
38
  }
38
39
 
40
+ // Helper: remove directory recursively
41
+ const removeDir = (dir) => {
42
+ if (existsSync(dir)) {
43
+ for (const item of readdirSync(dir)) {
44
+ const itemPath = join(dir, item)
45
+ if (statSync(itemPath).isDirectory()) {
46
+ removeDir(itemPath)
47
+ } else {
48
+ require('fs').unlinkSync(itemPath)
49
+ }
50
+ }
51
+ require('fs').rmdirSync(dir)
52
+ }
53
+ }
54
+
55
+ // Check cache version and clear if outdated
56
+ const checkCacheVersion = async () => {
57
+ const cacheSuitePackageJson = join(cacheDir, 'suite', 'package.json')
58
+ if (existsSync(cacheSuitePackageJson)) {
59
+ const cached = JSON.parse(readFileSync(cacheSuitePackageJson, 'utf-8'))
60
+ if (cached.version !== SUITE_VERSION) {
61
+ await client.app.log({
62
+ body: {
63
+ service: 'super-pocock-suite',
64
+ level: 'info',
65
+ message: `Cache outdated (v${cached.version}), clearing...`
66
+ }
67
+ })
68
+
69
+ // Clear outdated cache
70
+ const cachePackagesDir = join(process.env.HOME, '.cache', 'opencode', 'packages', '@super-pocock-ai')
71
+ if (existsSync(cachePackagesDir)) {
72
+ removeDir(cachePackagesDir)
73
+ }
74
+
75
+ // Clear config dependencies to force reinstall
76
+ const configPackagesDir = join(configDir, '@super-pocock-ai')
77
+ if (existsSync(configPackagesDir)) {
78
+ removeDir(configPackagesDir)
79
+ }
80
+
81
+ // Trigger reinstall by running npm update
82
+ try {
83
+ execSync('npm update @super-pocock-ai/suite', {
84
+ cwd: join(process.env.HOME, '.config', 'opencode'),
85
+ stdio: 'pipe'
86
+ })
87
+ } catch (e) {
88
+ // Ignore errors, will be handled by checkAndUpdate
89
+ }
90
+ }
91
+ }
92
+ }
93
+
94
+ await checkCacheVersion()
95
+
39
96
  // Ensure dependencies are copied from cache to config
40
97
  const ensureDependencies = async () => {
41
98
  const packages = ['suite', 'compose-agents', 'compose-workflow', 'memory-agents', 'memory-core']
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@super-pocock-ai/suite",
3
- "version": "2.0.10",
3
+ "version": "2.0.13",
4
4
  "description": "Superpocock 完整套件,包含记忆系统和工作流",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -13,10 +13,10 @@
13
13
  "postinstall": "node postinstall.js"
14
14
  },
15
15
  "dependencies": {
16
- "@super-pocock-ai/memory-core": "2.0.10",
17
- "@super-pocock-ai/memory-agents": "2.0.10",
18
- "@super-pocock-ai/compose-workflow": "2.0.10",
19
- "@super-pocock-ai/compose-agents": "2.0.10"
16
+ "@super-pocock-ai/memory-core": "2.0.13",
17
+ "@super-pocock-ai/memory-agents": "2.0.13",
18
+ "@super-pocock-ai/compose-workflow": "2.0.13",
19
+ "@super-pocock-ai/compose-agents": "2.0.13"
20
20
  },
21
21
  "keywords": [
22
22
  "opencode",