@super-pocock-ai/suite 2.0.5 → 2.0.8
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.
- package/index.js +81 -18
- package/package.json +5 -5
package/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync, mkdirSync, existsSync, readdirSync, statSync } from 'fs'
|
|
2
2
|
import { join, dirname } from 'path'
|
|
3
3
|
import { fileURLToPath } from 'url'
|
|
4
|
+
import { execSync } from 'child_process'
|
|
5
|
+
|
|
6
|
+
const SUITE_VERSION = '2.0.7'
|
|
4
7
|
|
|
5
8
|
export const SuperPocockSuite = async ({ project, client, $, directory, worktree }) => {
|
|
6
9
|
const agentsDir = join(process.env.HOME, '.config', 'opencode', 'agents')
|
|
@@ -14,22 +17,68 @@ export const SuperPocockSuite = async ({ project, client, $, directory, worktree
|
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
const configDir = join(process.env.HOME, '.config', 'opencode', 'node_modules')
|
|
20
|
+
|
|
21
|
+
// Check and update packages if needed
|
|
22
|
+
const checkAndUpdate = async () => {
|
|
23
|
+
const suiteDir = join(configDir, '@super-pocock-ai', 'suite')
|
|
24
|
+
const suitePackageJson = join(suiteDir, 'package.json')
|
|
25
|
+
|
|
26
|
+
if (existsSync(suitePackageJson)) {
|
|
27
|
+
const installed = JSON.parse(readFileSync(suitePackageJson, 'utf-8'))
|
|
28
|
+
if (installed.version !== SUITE_VERSION) {
|
|
29
|
+
await client.app.log({
|
|
30
|
+
body: {
|
|
31
|
+
service: 'super-pocock-suite',
|
|
32
|
+
level: 'info',
|
|
33
|
+
message: `Updating suite from v${installed.version} to v${SUITE_VERSION}...`
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
execSync('npm update @super-pocock-ai/suite --save', {
|
|
39
|
+
cwd: join(process.env.HOME, '.config', 'opencode'),
|
|
40
|
+
stdio: 'pipe'
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
await client.app.log({
|
|
44
|
+
body: {
|
|
45
|
+
service: 'super-pocock-suite',
|
|
46
|
+
level: 'info',
|
|
47
|
+
message: 'Suite updated successfully'
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
} catch (e) {
|
|
51
|
+
await client.app.log({
|
|
52
|
+
body: {
|
|
53
|
+
service: 'super-pocock-suite',
|
|
54
|
+
level: 'warn',
|
|
55
|
+
message: `Auto-update failed: ${e.message}. Please run: rm -rf ~/.cache/opencode/node_modules`
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
await checkAndUpdate()
|
|
17
64
|
|
|
18
|
-
//
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const files = readdirSync(
|
|
65
|
+
// Helper: install agents from a directory
|
|
66
|
+
const installAgents = async (sourceDir, label) => {
|
|
67
|
+
if (!existsSync(sourceDir)) return
|
|
68
|
+
const files = readdirSync(sourceDir)
|
|
22
69
|
for (const file of files) {
|
|
23
70
|
if (file.endsWith('.md')) {
|
|
24
|
-
const src = join(
|
|
71
|
+
const src = join(sourceDir, file)
|
|
25
72
|
const dest = join(agentsDir, file)
|
|
26
|
-
|
|
27
|
-
|
|
73
|
+
const srcContent = readFileSync(src, 'utf-8')
|
|
74
|
+
const destContent = existsSync(dest) ? readFileSync(dest, 'utf-8') : null
|
|
75
|
+
if (srcContent !== destContent) {
|
|
76
|
+
writeFileSync(dest, srcContent)
|
|
28
77
|
await client.app.log({
|
|
29
78
|
body: {
|
|
30
79
|
service: 'super-pocock-suite',
|
|
31
80
|
level: 'info',
|
|
32
|
-
message:
|
|
81
|
+
message: `${destContent ? 'Updated' : 'Installed'} ${label}: ${file}`
|
|
33
82
|
}
|
|
34
83
|
})
|
|
35
84
|
}
|
|
@@ -37,27 +86,29 @@ export const SuperPocockSuite = async ({ project, client, $, directory, worktree
|
|
|
37
86
|
}
|
|
38
87
|
}
|
|
39
88
|
|
|
40
|
-
//
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
const skillNames = readdirSync(
|
|
89
|
+
// Helper: install skills from a directory
|
|
90
|
+
const installSkills = async (sourceDir, prefix) => {
|
|
91
|
+
if (!existsSync(sourceDir)) return
|
|
92
|
+
const skillNames = readdirSync(sourceDir)
|
|
44
93
|
for (const skillName of skillNames) {
|
|
45
|
-
const skillDir = join(
|
|
94
|
+
const skillDir = join(sourceDir, skillName)
|
|
46
95
|
if (statSync(skillDir).isDirectory()) {
|
|
47
96
|
const skillFile = join(skillDir, 'SKILL.md')
|
|
48
97
|
if (existsSync(skillFile)) {
|
|
49
|
-
const destDir = join(skillsDir,
|
|
98
|
+
const destDir = join(skillsDir, `${prefix}-${skillName}`)
|
|
50
99
|
if (!existsSync(destDir)) {
|
|
51
100
|
mkdirSync(destDir, { recursive: true })
|
|
52
101
|
}
|
|
53
102
|
const destFile = join(destDir, 'SKILL.md')
|
|
54
|
-
|
|
55
|
-
|
|
103
|
+
const srcContent = readFileSync(skillFile, 'utf-8')
|
|
104
|
+
const destContent = existsSync(destFile) ? readFileSync(destFile, 'utf-8') : null
|
|
105
|
+
if (srcContent !== destContent) {
|
|
106
|
+
writeFileSync(destFile, srcContent)
|
|
56
107
|
await client.app.log({
|
|
57
108
|
body: {
|
|
58
109
|
service: 'super-pocock-suite',
|
|
59
110
|
level: 'info',
|
|
60
|
-
message:
|
|
111
|
+
message: `${destContent ? 'Updated' : 'Installed'} skill: ${prefix}-${skillName}`
|
|
61
112
|
}
|
|
62
113
|
})
|
|
63
114
|
}
|
|
@@ -66,13 +117,25 @@ export const SuperPocockSuite = async ({ project, client, $, directory, worktree
|
|
|
66
117
|
}
|
|
67
118
|
}
|
|
68
119
|
|
|
120
|
+
// Install compose agents
|
|
121
|
+
const composeAgentsDir = join(configDir, '@super-pocock-ai', 'compose-agents', 'agents')
|
|
122
|
+
await installAgents(composeAgentsDir, 'agent')
|
|
123
|
+
|
|
124
|
+
// Install memory agents
|
|
125
|
+
const memoryAgentsDir = join(configDir, '@super-pocock-ai', 'memory-agents', 'agents')
|
|
126
|
+
await installAgents(memoryAgentsDir, 'memory agent')
|
|
127
|
+
|
|
128
|
+
// Install compose skills
|
|
129
|
+
const composeSkillsDir = join(configDir, '@super-pocock-ai', 'compose-workflow', 'skills', 'compose')
|
|
130
|
+
await installSkills(composeSkillsDir, 'compose')
|
|
131
|
+
|
|
69
132
|
return {
|
|
70
133
|
"session.created": async ({ event }) => {
|
|
71
134
|
await client.app.log({
|
|
72
135
|
body: {
|
|
73
136
|
service: 'super-pocock-suite',
|
|
74
137
|
level: 'info',
|
|
75
|
-
message:
|
|
138
|
+
message: `Superpocock Suite v${SUITE_VERSION} loaded`
|
|
76
139
|
}
|
|
77
140
|
})
|
|
78
141
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@super-pocock-ai/suite",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "Superpocock 完整套件,包含记忆系统和工作流",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"README.md"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@super-pocock-ai/memory-core": "2.0.
|
|
13
|
-
"@super-pocock-ai/memory-agents": "2.0.
|
|
14
|
-
"@super-pocock-ai/compose-workflow": "2.0.
|
|
15
|
-
"@super-pocock-ai/compose-agents": "2.0.
|
|
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
16
|
},
|
|
17
17
|
"keywords": [
|
|
18
18
|
"opencode",
|