@super-pocock-ai/suite 2.0.8 → 2.0.10

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 (3) hide show
  1. package/index.js +51 -1
  2. package/package.json +9 -5
  3. package/postinstall.js +59 -0
package/index.js CHANGED
@@ -3,7 +3,7 @@ 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.7'
6
+ const SUITE_VERSION = '2.0.9'
7
7
 
8
8
  export const SuperPocockSuite = async ({ project, client, $, directory, worktree }) => {
9
9
  const agentsDir = join(process.env.HOME, '.config', 'opencode', 'agents')
@@ -17,6 +17,53 @@ export const SuperPocockSuite = async ({ project, client, $, directory, worktree
17
17
  }
18
18
 
19
19
  const configDir = join(process.env.HOME, '.config', 'opencode', 'node_modules')
20
+ const cacheDir = join(process.env.HOME, '.cache', 'opencode', 'packages', '@super-pocock-ai', 'suite', 'node_modules', '@super-pocock-ai')
21
+
22
+ // Helper: copy directory recursively
23
+ const copyDir = (src, dest) => {
24
+ if (!existsSync(src)) return
25
+ mkdirSync(dest, { recursive: true })
26
+ for (const item of readdirSync(src)) {
27
+ const srcPath = join(src, item)
28
+ const destPath = join(dest, item)
29
+ if (statSync(srcPath).isDirectory()) {
30
+ copyDir(srcPath, destPath)
31
+ } else {
32
+ if (!existsSync(destPath) || readFileSync(srcPath, 'utf-8') !== readFileSync(destPath, 'utf-8')) {
33
+ writeFileSync(destPath, readFileSync(srcPath))
34
+ }
35
+ }
36
+ }
37
+ }
38
+
39
+ // Ensure dependencies are copied from cache to config
40
+ const ensureDependencies = async () => {
41
+ const packages = ['suite', 'compose-agents', 'compose-workflow', 'memory-agents', 'memory-core']
42
+ const targetDir = join(configDir, '@super-pocock-ai')
43
+
44
+ if (!existsSync(targetDir)) {
45
+ mkdirSync(targetDir, { recursive: true })
46
+ }
47
+
48
+ for (const pkg of packages) {
49
+ const destPkg = join(targetDir, pkg)
50
+ if (!existsSync(join(destPkg, 'package.json'))) {
51
+ const srcPkg = join(cacheDir, pkg)
52
+ if (existsSync(srcPkg)) {
53
+ copyDir(srcPkg, destPkg)
54
+ await client.app.log({
55
+ body: {
56
+ service: 'super-pocock-suite',
57
+ level: 'info',
58
+ message: `Restored dependency: ${pkg}`
59
+ }
60
+ })
61
+ }
62
+ }
63
+ }
64
+ }
65
+
66
+ await ensureDependencies()
20
67
 
21
68
  // Check and update packages if needed
22
69
  const checkAndUpdate = async () => {
@@ -47,6 +94,9 @@ export const SuperPocockSuite = async ({ project, client, $, directory, worktree
47
94
  message: 'Suite updated successfully'
48
95
  }
49
96
  })
97
+
98
+ // Re-ensure dependencies after update
99
+ await ensureDependencies()
50
100
  } catch (e) {
51
101
  await client.app.log({
52
102
  body: {
package/package.json CHANGED
@@ -1,18 +1,22 @@
1
1
  {
2
2
  "name": "@super-pocock-ai/suite",
3
- "version": "2.0.8",
3
+ "version": "2.0.10",
4
4
  "description": "Superpocock 完整套件,包含记忆系统和工作流",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "files": [
8
8
  "index.js",
9
+ "postinstall.js",
9
10
  "README.md"
10
11
  ],
12
+ "scripts": {
13
+ "postinstall": "node postinstall.js"
14
+ },
11
15
  "dependencies": {
12
- "@super-pocock-ai/memory-core": "2.0.8",
13
- "@super-pocock-ai/memory-agents": "2.0.8",
14
- "@super-pocock-ai/compose-workflow": "2.0.8",
15
- "@super-pocock-ai/compose-agents": "2.0.8"
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
20
  },
17
21
  "keywords": [
18
22
  "opencode",
package/postinstall.js ADDED
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync, mkdirSync, readdirSync, statSync, copyFileSync } from 'fs'
3
+ import { join } from 'path'
4
+
5
+ const HOME = process.env.HOME
6
+ const CACHE_SUITE = join(HOME, '.cache', 'opencode', 'packages', '@super-pocock-ai', 'suite')
7
+ const CONFIG_MODULES = join(HOME, '.config', 'opencode', 'node_modules', '@super-pocock-ai')
8
+
9
+ // 确保目标目录存在
10
+ if (!existsSync(CONFIG_MODULES)) {
11
+ mkdirSync(CONFIG_MODULES, { recursive: true })
12
+ }
13
+
14
+ // 从缓存复制包到配置目录
15
+ const packages = ['suite', 'compose-agents', 'compose-workflow', 'memory-agents', 'memory-core']
16
+
17
+ for (const pkg of packages) {
18
+ const src = join(CACHE_SUITE, 'node_modules', '@super-pocock-ai', pkg)
19
+ const dest = join(CONFIG_MODULES, pkg)
20
+
21
+ if (existsSync(src) && !existsSync(dest)) {
22
+ mkdirSync(dest, { recursive: true })
23
+
24
+ // 复制 package.json
25
+ copyFileSync(join(src, 'package.json'), join(dest, 'package.json'))
26
+
27
+ // 复制其他文件和目录
28
+ const items = readdirSync(src)
29
+ for (const item of items) {
30
+ if (item === 'node_modules' || item === 'package.json') continue
31
+
32
+ const srcPath = join(src, item)
33
+ const destPath = join(dest, item)
34
+
35
+ if (statSync(srcPath).isDirectory()) {
36
+ // 递归复制目录
37
+ const copyDir = (s, d) => {
38
+ mkdirSync(d, { recursive: true })
39
+ for (const f of readdirSync(s)) {
40
+ const sf = join(s, f)
41
+ const df = join(d, f)
42
+ if (statSync(sf).isDirectory()) {
43
+ copyDir(sf, df)
44
+ } else {
45
+ copyFileSync(sf, df)
46
+ }
47
+ }
48
+ }
49
+ copyDir(srcPath, destPath)
50
+ } else {
51
+ copyFileSync(srcPath, destPath)
52
+ }
53
+ }
54
+
55
+ console.log(`[super-pocock-suite] Copied ${pkg} to config`)
56
+ }
57
+ }
58
+
59
+ console.log('[super-pocock-suite] Postinstall complete')