stigmergy 1.4.0 → 1.5.0-beta.1
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.
|
@@ -1,47 +1,57 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "1.0.0",
|
|
3
|
-
"description": "Stigmergy built-in skills configuration",
|
|
4
|
-
"skills": [
|
|
5
|
-
{
|
|
6
|
-
"name": "resumesession",
|
|
7
|
-
"displayName": "ResumeSession",
|
|
8
|
-
"description": "Cross-CLI session recovery and history management",
|
|
9
|
-
"version": "1.0.0",
|
|
10
|
-
"author": "stigmergy",
|
|
11
|
-
"type": "builtin",
|
|
12
|
-
"category": "session-management",
|
|
13
|
-
"entryPoint": "src/cli/commands/stigmergy-resume.js",
|
|
14
|
-
"agentskills": {
|
|
15
|
-
"name": "resumesession",
|
|
16
|
-
"description": "Cross-CLI session recovery and history management",
|
|
17
|
-
"version": "1.0.0",
|
|
18
|
-
"author": "stigmergy"
|
|
19
|
-
},
|
|
20
|
-
"deployment": {
|
|
21
|
-
"autoDeploy": true,
|
|
22
|
-
"targetCLIs": [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0.0",
|
|
3
|
+
"description": "Stigmergy built-in skills configuration",
|
|
4
|
+
"skills": [
|
|
5
|
+
{
|
|
6
|
+
"name": "resumesession",
|
|
7
|
+
"displayName": "ResumeSession",
|
|
8
|
+
"description": "Cross-CLI session recovery and history management",
|
|
9
|
+
"version": "1.0.0",
|
|
10
|
+
"author": "stigmergy",
|
|
11
|
+
"type": "builtin",
|
|
12
|
+
"category": "session-management",
|
|
13
|
+
"entryPoint": "src/cli/commands/stigmergy-resume.js",
|
|
14
|
+
"agentskills": {
|
|
15
|
+
"name": "resumesession",
|
|
16
|
+
"description": "Cross-CLI session recovery and history management",
|
|
17
|
+
"version": "1.0.0",
|
|
18
|
+
"author": "stigmergy"
|
|
19
|
+
},
|
|
20
|
+
"deployment": {
|
|
21
|
+
"autoDeploy": true,
|
|
22
|
+
"targetCLIs": [
|
|
23
|
+
"claude",
|
|
24
|
+
"codex",
|
|
25
|
+
"iflow",
|
|
26
|
+
"qwen",
|
|
27
|
+
"qodercli",
|
|
28
|
+
"codebuddy",
|
|
29
|
+
"kilocode",
|
|
30
|
+
"kode",
|
|
31
|
+
"opencode"
|
|
32
|
+
],
|
|
33
|
+
"files": [
|
|
34
|
+
{
|
|
35
|
+
"source": "skills/resumesession/SKILL.md",
|
|
36
|
+
"destination": "skills/resumesession/SKILL.md"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"source": "skills/resumesession/__init__.py",
|
|
40
|
+
"destination": "skills/resumesession/__init__.py"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"source": "skills/resumesession/independent-resume.js",
|
|
44
|
+
"destination": "skills/resumesession/independent-resume.js"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"commands": {
|
|
49
|
+
"stigmergy": {
|
|
50
|
+
"name": "resume",
|
|
51
|
+
"description": "Resume session - Cross-CLI session recovery and history management",
|
|
52
|
+
"handler": "src/cli/commands/simple-resume.js"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Stigmergy Post-install 部署脚本
|
|
3
3
|
* 在 npm install -g stigmergy 后自动:
|
|
4
4
|
* 1. 运行 auto-install(安装 CLI tools)
|
|
5
|
-
* 2. 部署 hooks 和 skills
|
|
5
|
+
* 2. 部署 hooks 和 skills(iflow-bundle + builtin-skills)
|
|
6
6
|
* 3. 自动进入交互模式
|
|
7
7
|
*/
|
|
8
8
|
|
|
@@ -15,7 +15,7 @@ async function postInstallDeploy() {
|
|
|
15
15
|
console.log("=".repeat(60));
|
|
16
16
|
|
|
17
17
|
// 步骤1: 运行 auto-install(安装 CLI tools)
|
|
18
|
-
console.log("\n📦 步骤 1/
|
|
18
|
+
console.log("\n📦 步骤 1/4: 自动安装 CLI tools...\n");
|
|
19
19
|
|
|
20
20
|
try {
|
|
21
21
|
await runCommand("node", ["src/index.js", "auto-install"]);
|
|
@@ -24,8 +24,8 @@ async function postInstallDeploy() {
|
|
|
24
24
|
console.log(" ⚠️ Auto-install 遇到问题,继续部署...\n");
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
// 步骤2: 部署
|
|
28
|
-
console.log("📦 步骤 2/
|
|
27
|
+
// 步骤2: 部署 iflow-bundle(agents)
|
|
28
|
+
console.log("📦 步骤 2/4: 部署 iflow agents...\n");
|
|
29
29
|
|
|
30
30
|
try {
|
|
31
31
|
const ConfigDeployer = require("../src/core/config/ConfigDeployer");
|
|
@@ -42,20 +42,35 @@ async function postInstallDeploy() {
|
|
|
42
42
|
dryRun: false,
|
|
43
43
|
});
|
|
44
44
|
await deployer.run();
|
|
45
|
+
console.log("\n✅ iflow agents 部署完成\n");
|
|
45
46
|
} catch (error) {
|
|
46
|
-
console.log(" ⚠️
|
|
47
|
+
console.log(" ⚠️ iflow-bundle 部署跳过\n");
|
|
47
48
|
}
|
|
48
49
|
|
|
50
|
+
// 步骤3: 部署 builtin skills(resumesession)
|
|
51
|
+
console.log("📦 步骤 3/4: 部署内置 skills...\n");
|
|
52
|
+
|
|
49
53
|
try {
|
|
50
|
-
|
|
54
|
+
const BuiltinSkillsDeployer = require("../src/core/skills/BuiltinSkillsDeployer");
|
|
55
|
+
const skillsDeployer = new BuiltinSkillsDeployer();
|
|
56
|
+
const result = await skillsDeployer.deployAll();
|
|
57
|
+
if (result.success) {
|
|
58
|
+
console.log("\n✅ 内置 skills 部署完成\n");
|
|
59
|
+
}
|
|
51
60
|
} catch (error) {
|
|
52
|
-
console.log(" ⚠️
|
|
61
|
+
console.log(" ⚠️ 内置 skills 部署遇到问题\n");
|
|
53
62
|
}
|
|
54
63
|
|
|
55
|
-
|
|
64
|
+
// 步骤4: 部署 hooks
|
|
65
|
+
console.log("📦 步骤 4/4: 部署 hooks...\n");
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
await runCommand("node", ["src/index.js", "deploy"]);
|
|
69
|
+
console.log("\n✅ hooks 部署完成\n");
|
|
70
|
+
} catch (error) {
|
|
71
|
+
console.log(" ⚠️ hooks 部署遇到问题\n");
|
|
72
|
+
}
|
|
56
73
|
|
|
57
|
-
// 步骤3: 自动进入交互模式
|
|
58
|
-
console.log("\n📦 步骤 3/3: 启动交互模式...\n");
|
|
59
74
|
console.log("=".repeat(60));
|
|
60
75
|
console.log("✅ Stigmergy 安装配置完成!");
|
|
61
76
|
console.log("🚀 正在进入交互模式...\n");
|
|
@@ -4,23 +4,23 @@
|
|
|
4
4
|
* 为 OpenCode CLI 安装 Stigmergy 集成
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
const fs = require(
|
|
8
|
-
const path = require(
|
|
9
|
-
const os = require(
|
|
7
|
+
const fs = require("fs");
|
|
8
|
+
const path = require("path");
|
|
9
|
+
const os = require("os");
|
|
10
10
|
|
|
11
11
|
class OpenCodeIntegrationInstaller {
|
|
12
12
|
constructor() {
|
|
13
13
|
this.homeDir = os.homedir();
|
|
14
|
-
this.opencodeConfigPath = path.join(this.homeDir,
|
|
15
|
-
this.hooksDir = path.join(this.opencodeConfigPath,
|
|
16
|
-
this.skillsDir = path.join(this.opencodeConfigPath,
|
|
14
|
+
this.opencodeConfigPath = path.join(this.homeDir, ".opencode");
|
|
15
|
+
this.hooksDir = path.join(this.opencodeConfigPath, "hooks");
|
|
16
|
+
this.skillsDir = path.join(this.opencodeConfigPath, "skills");
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* 安装 OpenCode 集成
|
|
21
21
|
*/
|
|
22
22
|
async install() {
|
|
23
|
-
console.log(
|
|
23
|
+
console.log("🔧 开始安装 OpenCode 集成...\n");
|
|
24
24
|
|
|
25
25
|
try {
|
|
26
26
|
// 1. 创建必要的目录
|
|
@@ -35,13 +35,13 @@ class OpenCodeIntegrationInstaller {
|
|
|
35
35
|
// 4. 更新配置
|
|
36
36
|
this.updateConfig();
|
|
37
37
|
|
|
38
|
-
console.log(
|
|
39
|
-
console.log(
|
|
40
|
-
console.log(
|
|
38
|
+
console.log("\n✅ OpenCode 集成安装完成!");
|
|
39
|
+
console.log("📁 配置目录: " + this.opencodeConfigPath);
|
|
40
|
+
console.log("💡 现在可以在 OpenCode 中使用 /resumesession 命令");
|
|
41
41
|
|
|
42
42
|
return { success: true };
|
|
43
43
|
} catch (error) {
|
|
44
|
-
console.error(
|
|
44
|
+
console.error("\n❌ 安装失败:", error.message);
|
|
45
45
|
return { success: false, error: error.message };
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -50,20 +50,20 @@ class OpenCodeIntegrationInstaller {
|
|
|
50
50
|
* 创建必要的目录
|
|
51
51
|
*/
|
|
52
52
|
createDirectories() {
|
|
53
|
-
console.log(
|
|
53
|
+
console.log("📁 创建目录结构...");
|
|
54
54
|
|
|
55
55
|
const directories = [
|
|
56
56
|
this.opencodeConfigPath,
|
|
57
57
|
this.hooksDir,
|
|
58
|
-
this.skillsDir
|
|
58
|
+
this.skillsDir,
|
|
59
59
|
];
|
|
60
60
|
|
|
61
61
|
for (const dir of directories) {
|
|
62
62
|
if (!fs.existsSync(dir)) {
|
|
63
63
|
fs.mkdirSync(dir, { recursive: true });
|
|
64
|
-
console.log(
|
|
64
|
+
console.log(" ✅ 创建: " + dir);
|
|
65
65
|
} else {
|
|
66
|
-
console.log(
|
|
66
|
+
console.log(" ℹ️ 已存在: " + dir);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -72,12 +72,12 @@ class OpenCodeIntegrationInstaller {
|
|
|
72
72
|
* 部署 hooks
|
|
73
73
|
*/
|
|
74
74
|
deployHooks() {
|
|
75
|
-
console.log(
|
|
75
|
+
console.log("\n🔗 部署 hooks...");
|
|
76
76
|
|
|
77
77
|
const hookContent = `#!/usr/bin/env node
|
|
78
78
|
/**
|
|
79
79
|
* OpenCode AI CLI Integration Hook
|
|
80
|
-
* Generated by Stigmergy CLI v${require(
|
|
80
|
+
* Generated by Stigmergy CLI v${require("../../../package.json").version}
|
|
81
81
|
*/
|
|
82
82
|
|
|
83
83
|
const fs = require('fs');
|
|
@@ -106,13 +106,13 @@ class OpencodeHook {
|
|
|
106
106
|
module.exports = OpencodeHook;
|
|
107
107
|
`;
|
|
108
108
|
|
|
109
|
-
const hookFilePath = path.join(this.hooksDir,
|
|
109
|
+
const hookFilePath = path.join(this.hooksDir, "opencode_hook.js");
|
|
110
110
|
|
|
111
111
|
if (!fs.existsSync(hookFilePath)) {
|
|
112
|
-
fs.writeFileSync(hookFilePath, hookContent,
|
|
113
|
-
console.log(
|
|
112
|
+
fs.writeFileSync(hookFilePath, hookContent, "utf8");
|
|
113
|
+
console.log(" ✅ 创建: opencode_hook.js");
|
|
114
114
|
} else {
|
|
115
|
-
console.log(
|
|
115
|
+
console.log(" ℹ️ 已存在: opencode_hook.js");
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
@@ -120,18 +120,21 @@ module.exports = OpencodeHook;
|
|
|
120
120
|
* 部署 skills
|
|
121
121
|
*/
|
|
122
122
|
deploySkills() {
|
|
123
|
-
console.log(
|
|
123
|
+
console.log("\n⚡ 部署 skills...");
|
|
124
124
|
|
|
125
125
|
// 复制 resumesession 技能
|
|
126
|
-
const sourceSkillPath = path.join(
|
|
127
|
-
|
|
126
|
+
const sourceSkillPath = path.join(
|
|
127
|
+
__dirname,
|
|
128
|
+
"../../../skills/resumesession/opencode-resume.js",
|
|
129
|
+
);
|
|
130
|
+
const targetSkillPath = path.join(this.skillsDir, "resumesession.js");
|
|
128
131
|
|
|
129
132
|
if (fs.existsSync(sourceSkillPath)) {
|
|
130
|
-
const skillContent = fs.readFileSync(sourceSkillPath,
|
|
131
|
-
fs.writeFileSync(targetSkillPath, skillContent,
|
|
132
|
-
console.log(
|
|
133
|
+
const skillContent = fs.readFileSync(sourceSkillPath, "utf8");
|
|
134
|
+
fs.writeFileSync(targetSkillPath, skillContent, "utf8");
|
|
135
|
+
console.log(" ✅ 部署: resumesession.js");
|
|
133
136
|
} else {
|
|
134
|
-
console.log(
|
|
137
|
+
console.log(" ⚠️ 未找到: opencode-resume.js");
|
|
135
138
|
}
|
|
136
139
|
}
|
|
137
140
|
|
|
@@ -139,16 +142,16 @@ module.exports = OpencodeHook;
|
|
|
139
142
|
* 更新配置
|
|
140
143
|
*/
|
|
141
144
|
updateConfig() {
|
|
142
|
-
console.log(
|
|
145
|
+
console.log("\n⚙️ 更新配置...");
|
|
143
146
|
|
|
144
|
-
const configPath = path.join(this.opencodeConfigPath,
|
|
145
|
-
const hooksJsonPath = path.join(this.opencodeConfigPath,
|
|
147
|
+
const configPath = path.join(this.opencodeConfigPath, "config.json");
|
|
148
|
+
const hooksJsonPath = path.join(this.opencodeConfigPath, "hooks.json");
|
|
146
149
|
|
|
147
150
|
// 更新 hooks.json
|
|
148
151
|
const hooksConfig = {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
+
cross_cli_adapter: {
|
|
153
|
+
enabled: true,
|
|
154
|
+
supported_tools: [
|
|
152
155
|
"claude",
|
|
153
156
|
"gemini",
|
|
154
157
|
"qwen",
|
|
@@ -156,59 +159,65 @@ module.exports = OpencodeHook;
|
|
|
156
159
|
"qodercli",
|
|
157
160
|
"codebuddy",
|
|
158
161
|
"copilot",
|
|
159
|
-
"codex"
|
|
162
|
+
"codex",
|
|
163
|
+
"kilocode",
|
|
164
|
+
"kode",
|
|
160
165
|
],
|
|
161
|
-
|
|
162
|
-
"use\\s+(\\w+)\\s+to\\s+(.+)
|
|
163
|
-
"call\\s+(\\w+)\\s+(.+)
|
|
164
|
-
"ask\\s+(\\w+)\\s+(.+)
|
|
165
|
-
"stigmergy\\s+(\\w+)\\s+(.+)
|
|
166
|
-
]
|
|
167
|
-
}
|
|
166
|
+
trigger_patterns: [
|
|
167
|
+
"use\\s+(\\w+)\\s+to\\s+(.+)",
|
|
168
|
+
"call\\s+(\\w+)\\s+(.+)",
|
|
169
|
+
"ask\\s+(\\w+)\\s+(.+)",
|
|
170
|
+
"stigmergy\\s+(\\w+)\\s+(.+)",
|
|
171
|
+
],
|
|
172
|
+
},
|
|
168
173
|
};
|
|
169
174
|
|
|
170
|
-
fs.writeFileSync(
|
|
171
|
-
|
|
175
|
+
fs.writeFileSync(
|
|
176
|
+
hooksJsonPath,
|
|
177
|
+
JSON.stringify(hooksConfig, null, 2),
|
|
178
|
+
"utf8",
|
|
179
|
+
);
|
|
180
|
+
console.log(" ✅ 更新: hooks.json");
|
|
172
181
|
|
|
173
182
|
// 更新 config.json
|
|
174
183
|
let config = {};
|
|
175
184
|
if (fs.existsSync(configPath)) {
|
|
176
185
|
try {
|
|
177
|
-
config = JSON.parse(fs.readFileSync(configPath,
|
|
186
|
+
config = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
178
187
|
} catch (error) {
|
|
179
|
-
console.log(
|
|
188
|
+
console.log(" ⚠️ 无法读取现有配置,将创建新配置");
|
|
180
189
|
}
|
|
181
190
|
}
|
|
182
191
|
|
|
183
192
|
// 添加 Stigmergy 配置
|
|
184
193
|
config.stigmergy = {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
194
|
+
enabled: true,
|
|
195
|
+
version: require("../../../package.json").version,
|
|
196
|
+
skills: ["resumesession"],
|
|
188
197
|
};
|
|
189
198
|
|
|
190
|
-
fs.writeFileSync(configPath, JSON.stringify(config, null, 2),
|
|
191
|
-
console.log(
|
|
199
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2), "utf8");
|
|
200
|
+
console.log(" ✅ 更新: config.json");
|
|
192
201
|
}
|
|
193
202
|
|
|
194
203
|
/**
|
|
195
204
|
* 卸载 OpenCode 集成
|
|
196
205
|
*/
|
|
197
206
|
async uninstall() {
|
|
198
|
-
console.log(
|
|
207
|
+
console.log("🗑️ 开始卸载 OpenCode 集成...\n");
|
|
199
208
|
|
|
200
209
|
try {
|
|
201
210
|
// 删除技能文件
|
|
202
|
-
const skillPath = path.join(this.skillsDir,
|
|
211
|
+
const skillPath = path.join(this.skillsDir, "resumesession.js");
|
|
203
212
|
if (fs.existsSync(skillPath)) {
|
|
204
213
|
fs.unlinkSync(skillPath);
|
|
205
|
-
console.log(
|
|
214
|
+
console.log(" ✅ 删除: resumesession.js");
|
|
206
215
|
}
|
|
207
216
|
|
|
208
|
-
console.log(
|
|
217
|
+
console.log("\n✅ OpenCode 集成卸载完成!");
|
|
209
218
|
return { success: true };
|
|
210
219
|
} catch (error) {
|
|
211
|
-
console.error(
|
|
220
|
+
console.error("\n❌ 卸载失败:", error.message);
|
|
212
221
|
return { success: false, error: error.message };
|
|
213
222
|
}
|
|
214
223
|
}
|
|
@@ -219,15 +228,15 @@ if (require.main === module) {
|
|
|
219
228
|
const installer = new OpenCodeIntegrationInstaller();
|
|
220
229
|
const args = process.argv.slice(2);
|
|
221
230
|
|
|
222
|
-
if (args.includes(
|
|
223
|
-
installer.uninstall().then(result => {
|
|
231
|
+
if (args.includes("--uninstall")) {
|
|
232
|
+
installer.uninstall().then((result) => {
|
|
224
233
|
process.exit(result.success ? 0 : 1);
|
|
225
234
|
});
|
|
226
235
|
} else {
|
|
227
|
-
installer.install().then(result => {
|
|
236
|
+
installer.install().then((result) => {
|
|
228
237
|
process.exit(result.success ? 0 : 1);
|
|
229
238
|
});
|
|
230
239
|
}
|
|
231
240
|
}
|
|
232
241
|
|
|
233
|
-
module.exports = OpenCodeIntegrationInstaller;
|
|
242
|
+
module.exports = OpenCodeIntegrationInstaller;
|
package/src/core/cli_tools.js
CHANGED
|
@@ -92,7 +92,15 @@ const CLI_TOOLS = {
|
|
|
92
92
|
install: "npm install -g opencode-ai",
|
|
93
93
|
hooksDir: path.join(os.homedir(), ".opencode", "hooks"),
|
|
94
94
|
config: path.join(os.homedir(), ".opencode", "config.json"),
|
|
95
|
-
autoInstall:
|
|
95
|
+
autoInstall: true,
|
|
96
|
+
},
|
|
97
|
+
"oh-my-opencode": {
|
|
98
|
+
name: "Oh-My-OpenCode Plugin Manager",
|
|
99
|
+
version: "oh-my-opencode --version",
|
|
100
|
+
install: "npm install -g opencode-ai && npm install -g @kilocode/cli",
|
|
101
|
+
hooksDir: path.join(os.homedir(), ".opencode", "plugins"),
|
|
102
|
+
config: path.join(os.homedir(), ".opencode", "config.json"),
|
|
103
|
+
autoInstall: false, // 通过 opencode 安装,不需要单独安装
|
|
96
104
|
},
|
|
97
105
|
"oh-my-opencode": {
|
|
98
106
|
name: "Oh-My-OpenCode Plugin Manager",
|