openmatrix 0.2.28 → 0.2.30
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/dist/cli/commands/install-skills.js +120 -79
- package/package.json +1 -1
- package/scripts/install-skills.js +41 -0
- package/skills/SKILL.md +54 -0
|
@@ -40,12 +40,16 @@ const fs = __importStar(require("fs"));
|
|
|
40
40
|
const path = __importStar(require("path"));
|
|
41
41
|
const os = __importStar(require("os"));
|
|
42
42
|
exports.installSkillsCommand = new commander_1.Command('install-skills')
|
|
43
|
-
.description('Install OpenMatrix skills to ~/.claude/commands/om/')
|
|
43
|
+
.description('Install OpenMatrix skills to ~/.claude/commands/om/ and ~/.matrix/skills/om/ (if MatrixCode detected)')
|
|
44
44
|
.option('-f, --force', 'Force overwrite existing skills', false)
|
|
45
45
|
.action((options) => {
|
|
46
46
|
const skillsDir = path.join(__dirname, '..', '..', '..', 'skills');
|
|
47
47
|
const claudeDir = path.join(os.homedir(), '.claude');
|
|
48
|
-
const
|
|
48
|
+
const claudeCommandsDir = path.join(claudeDir, 'commands', 'om');
|
|
49
|
+
// Check for MatrixCode installation
|
|
50
|
+
const matrixDir = path.join(os.homedir(), '.matrix');
|
|
51
|
+
const matrixSkillsDir = path.join(matrixDir, 'skills', 'om');
|
|
52
|
+
const hasMatrixCode = fs.existsSync(matrixDir);
|
|
49
53
|
console.log('📦 OpenMatrix Skills Installer\n');
|
|
50
54
|
// Check if skills directory exists
|
|
51
55
|
if (!fs.existsSync(skillsDir)) {
|
|
@@ -53,106 +57,143 @@ exports.installSkillsCommand = new commander_1.Command('install-skills')
|
|
|
53
57
|
console.error(' Make sure openmatrix is installed correctly.');
|
|
54
58
|
process.exit(1);
|
|
55
59
|
}
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
catch (err) {
|
|
64
|
-
console.error('❌ Cannot create directory:', commandsDir);
|
|
65
|
-
console.error(' Error:', err instanceof Error ? err.message : String(err));
|
|
66
|
-
process.exit(1);
|
|
67
|
-
}
|
|
68
|
-
// Get skill files (excluding om.md and openmatrix.md which are handled separately)
|
|
60
|
+
// Define target directories
|
|
61
|
+
const targets = [
|
|
62
|
+
{ name: 'Claude Code', dir: claudeCommandsDir, enabled: true },
|
|
63
|
+
{ name: 'MatrixCode', dir: matrixSkillsDir, enabled: hasMatrixCode },
|
|
64
|
+
];
|
|
65
|
+
// Get skill files
|
|
69
66
|
const files = fs.readdirSync(skillsDir).filter(f => f.endsWith('.md') && f !== 'om.md' && f !== 'openmatrix.md');
|
|
70
67
|
if (files.length === 0) {
|
|
71
68
|
console.error('❌ No skill files found in:', skillsDir);
|
|
72
69
|
process.exit(1);
|
|
73
70
|
}
|
|
74
71
|
console.log(`📋 Found ${files.length} skill files\n`);
|
|
75
|
-
let
|
|
76
|
-
let
|
|
77
|
-
let
|
|
78
|
-
// Install
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
let totalInstalled = 0;
|
|
73
|
+
let totalSkipped = 0;
|
|
74
|
+
let totalFailed = 0;
|
|
75
|
+
// Install to each target
|
|
76
|
+
for (const target of targets) {
|
|
77
|
+
if (!target.enabled) {
|
|
78
|
+
console.log(`⏭️ ${target.name}: skipped (not installed)`);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
console.log(`\n🔧 Installing to ${target.name}...`);
|
|
82
82
|
try {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
console.log(
|
|
86
|
-
skipped++;
|
|
87
|
-
return;
|
|
83
|
+
if (!fs.existsSync(target.dir)) {
|
|
84
|
+
fs.mkdirSync(target.dir, { recursive: true });
|
|
85
|
+
console.log(`📁 Created directory: ${target.dir}`);
|
|
88
86
|
}
|
|
89
|
-
fs.copyFileSync(src, dest);
|
|
90
|
-
const skillName = path.basename(file, '.md');
|
|
91
|
-
console.log(` ✅ Installed: /om:${skillName}`);
|
|
92
|
-
installed++;
|
|
93
87
|
}
|
|
94
88
|
catch (err) {
|
|
95
|
-
console.
|
|
96
|
-
|
|
89
|
+
console.error(`❌ Cannot create directory: ${target.dir}`);
|
|
90
|
+
console.error(` Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
91
|
+
continue;
|
|
97
92
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
93
|
+
let installed = 0;
|
|
94
|
+
let skipped = 0;
|
|
95
|
+
let failed = 0;
|
|
96
|
+
// Install skill files
|
|
97
|
+
files.forEach(file => {
|
|
98
|
+
const src = path.join(skillsDir, file);
|
|
99
|
+
const dest = path.join(target.dir, file);
|
|
100
|
+
try {
|
|
101
|
+
if (fs.existsSync(dest) && !options.force) {
|
|
102
|
+
skipped++;
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
fs.copyFileSync(src, dest);
|
|
111
106
|
installed++;
|
|
112
107
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
failed++;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
// Install auto-detection instructions
|
|
120
|
-
const autoSrc = path.join(skillsDir, 'openmatrix.md');
|
|
121
|
-
const autoDest = path.join(claudeDir, 'commands', 'openmatrix.md');
|
|
122
|
-
if (fs.existsSync(autoSrc)) {
|
|
123
|
-
try {
|
|
124
|
-
if (fs.existsSync(autoDest) && !options.force) {
|
|
125
|
-
console.log(` ⏭️ Skipped: openmatrix.md (already exists)`);
|
|
126
|
-
skipped++;
|
|
108
|
+
catch (err) {
|
|
109
|
+
console.log(` ❌ Failed: ${file} (${err instanceof Error ? err.message : String(err)})`);
|
|
110
|
+
failed++;
|
|
127
111
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
112
|
+
});
|
|
113
|
+
// Install om.md to parent directory for Claude Code
|
|
114
|
+
if (target.name === 'Claude Code') {
|
|
115
|
+
const omSrc = path.join(skillsDir, 'om.md');
|
|
116
|
+
const omDest = path.join(claudeDir, 'commands', 'om.md');
|
|
117
|
+
if (fs.existsSync(omSrc)) {
|
|
118
|
+
try {
|
|
119
|
+
if (fs.existsSync(omDest) && !options.force) {
|
|
120
|
+
skipped++;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
fs.copyFileSync(omSrc, omDest);
|
|
124
|
+
installed++;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
failed++;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// Install openmatrix.md (auto-detection)
|
|
132
|
+
const autoSrc = path.join(skillsDir, 'openmatrix.md');
|
|
133
|
+
const autoDest = path.join(claudeDir, 'commands', 'openmatrix.md');
|
|
134
|
+
if (fs.existsSync(autoSrc)) {
|
|
135
|
+
try {
|
|
136
|
+
if (fs.existsSync(autoDest) && !options.force) {
|
|
137
|
+
skipped++;
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
fs.copyFileSync(autoSrc, autoDest);
|
|
141
|
+
installed++;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
catch (err) {
|
|
145
|
+
failed++;
|
|
146
|
+
}
|
|
132
147
|
}
|
|
133
148
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
149
|
+
// Install SKILL.md for MatrixCode (skill package manifest)
|
|
150
|
+
if (target.name === 'MatrixCode') {
|
|
151
|
+
const skillManifestSrc = path.join(skillsDir, 'SKILL.md');
|
|
152
|
+
const skillManifestDest = path.join(target.dir, 'SKILL.md');
|
|
153
|
+
if (fs.existsSync(skillManifestSrc)) {
|
|
154
|
+
try {
|
|
155
|
+
if (fs.existsSync(skillManifestDest) && !options.force) {
|
|
156
|
+
skipped++;
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
fs.copyFileSync(skillManifestSrc, skillManifestDest);
|
|
160
|
+
installed++;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
catch (err) {
|
|
164
|
+
failed++;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
console.log(` ✅ Installed: ${installed}`);
|
|
169
|
+
console.log(` ⏭️ Skipped: ${skipped}`);
|
|
170
|
+
if (failed > 0) {
|
|
171
|
+
console.log(` ❌ Failed: ${failed}`);
|
|
137
172
|
}
|
|
173
|
+
totalInstalled += installed;
|
|
174
|
+
totalSkipped += skipped;
|
|
175
|
+
totalFailed += failed;
|
|
138
176
|
}
|
|
139
177
|
console.log('\n' + '─'.repeat(50));
|
|
140
|
-
console.log(`📊 Summary:`);
|
|
141
|
-
console.log(` ✅ Installed: ${
|
|
142
|
-
console.log(` ⏭️ Skipped: ${
|
|
143
|
-
console.log(` ❌ Failed: ${
|
|
144
|
-
console.log(
|
|
145
|
-
|
|
146
|
-
|
|
178
|
+
console.log(`📊 Total Summary:`);
|
|
179
|
+
console.log(` ✅ Installed: ${totalInstalled}`);
|
|
180
|
+
console.log(` ⏭️ Skipped: ${totalSkipped}`);
|
|
181
|
+
console.log(` ❌ Failed: ${totalFailed}`);
|
|
182
|
+
console.log('\n📁 Installation locations:');
|
|
183
|
+
for (const target of targets) {
|
|
184
|
+
if (target.enabled) {
|
|
185
|
+
console.log(` ${target.name}: ${target.dir}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (totalInstalled > 0) {
|
|
147
189
|
console.log('\n🎉 Skills installed successfully!');
|
|
148
190
|
console.log(' Try: /om <your task>');
|
|
149
191
|
console.log(' Or: /om:start <your task>');
|
|
150
|
-
console.log('\n💡 Auto-detection enabled!');
|
|
151
|
-
console.log(' Type task descriptions directly:');
|
|
152
|
-
console.log(' - "实现用户登录功能" → auto invokes /om:start');
|
|
153
|
-
console.log(' - "fix the login bug" → auto invokes /om:start');
|
|
154
192
|
}
|
|
155
|
-
if (
|
|
193
|
+
if (hasMatrixCode) {
|
|
194
|
+
console.log('\n✅ MatrixCode detected! Skills also installed to ~/.matrix/skills/om/');
|
|
195
|
+
}
|
|
196
|
+
if (totalFailed > 0) {
|
|
156
197
|
process.exit(1);
|
|
157
198
|
}
|
|
158
199
|
});
|
package/package.json
CHANGED
|
@@ -16,13 +16,29 @@ const targets = [
|
|
|
16
16
|
{
|
|
17
17
|
name: 'Claude Code',
|
|
18
18
|
dir: path.join(os.homedir(), '.claude', 'commands', 'om'),
|
|
19
|
+
isClaudeCode: true,
|
|
19
20
|
},
|
|
20
21
|
{
|
|
21
22
|
name: 'OpenCode',
|
|
22
23
|
dir: path.join(os.homedir(), '.config', 'opencode', 'commands', 'om'),
|
|
24
|
+
isClaudeCode: false,
|
|
23
25
|
},
|
|
24
26
|
];
|
|
25
27
|
|
|
28
|
+
// Check for MatrixCode installation
|
|
29
|
+
// MatrixCode uses ~/.matrix/ directory for configuration
|
|
30
|
+
const matrixDir = path.join(os.homedir(), '.matrix');
|
|
31
|
+
const matrixSkillsDir = path.join(matrixDir, 'skills', 'om');
|
|
32
|
+
|
|
33
|
+
// If ~/.matrix/ exists, add MatrixCode as a target
|
|
34
|
+
if (fs.existsSync(matrixDir)) {
|
|
35
|
+
targets.push({
|
|
36
|
+
name: 'MatrixCode',
|
|
37
|
+
dir: matrixSkillsDir,
|
|
38
|
+
isMatrixCode: true,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
26
42
|
if (!fs.existsSync(skillsDir)) {
|
|
27
43
|
console.log('Skills directory not found, skipping installation.');
|
|
28
44
|
process.exit(0);
|
|
@@ -49,6 +65,31 @@ for (const target of targets) {
|
|
|
49
65
|
}
|
|
50
66
|
}
|
|
51
67
|
|
|
68
|
+
// For Claude Code: install om.md and openmatrix.md to parent directory
|
|
69
|
+
if (target.isClaudeCode) {
|
|
70
|
+
const claudeCommandsDir = path.join(os.homedir(), '.claude', 'commands');
|
|
71
|
+
const omSrc = path.join(skillsDir, 'om.md');
|
|
72
|
+
const omDest = path.join(claudeCommandsDir, 'om.md');
|
|
73
|
+
if (fs.existsSync(omSrc)) {
|
|
74
|
+
try {
|
|
75
|
+
fs.copyFileSync(omSrc, omDest);
|
|
76
|
+
installed++;
|
|
77
|
+
} catch (copyErr) {
|
|
78
|
+
console.log(` ⚠️ Skipped: om.md (${copyErr.message})`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const autoSrc = path.join(skillsDir, 'openmatrix.md');
|
|
82
|
+
const autoDest = path.join(claudeCommandsDir, 'openmatrix.md');
|
|
83
|
+
if (fs.existsSync(autoSrc)) {
|
|
84
|
+
try {
|
|
85
|
+
fs.copyFileSync(autoSrc, autoDest);
|
|
86
|
+
installed++;
|
|
87
|
+
} catch (copyErr) {
|
|
88
|
+
console.log(` ⚠️ Skipped: openmatrix.md (${copyErr.message})`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
52
93
|
console.log(`✅ ${target.name}: ${installed} skills installed to ${target.dir}`);
|
|
53
94
|
} catch (err) {
|
|
54
95
|
console.log(`⚠️ ${target.name}: skipped (${err.message})`);
|
package/skills/SKILL.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: om
|
|
3
|
+
description: "OpenMatrix - AI Agent 任务编排系统,自动化测试生成,覆盖率 >80%。提供 /om 命令族:/om:start、/om:feature、/om:brainstorm、/om:auto、/om:debug 等。"
|
|
4
|
+
priority: critical
|
|
5
|
+
always_load: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# OpenMatrix Skills Package
|
|
9
|
+
|
|
10
|
+
你的代码没测试?OpenMatrix 自动帮你补,覆盖率 >80%
|
|
11
|
+
|
|
12
|
+
## 可用 Skills
|
|
13
|
+
|
|
14
|
+
| Skill | 描述 | 用途 |
|
|
15
|
+
|-------|------|------|
|
|
16
|
+
| `/om` | 默认入口 | AI 推荐路由,用户确认后执行 |
|
|
17
|
+
| `/om:start` | 标准流程 | 完整追踪,质量门禁,任务明确可直接执行 |
|
|
18
|
+
| `/om:feature` | 小需求流程 | 2-5 个任务块,轻量追踪,适合单一改动点 |
|
|
19
|
+
| `/om:brainstorm` | 澄清/设计 | 先澄清不明确点或设计方案,再执行 |
|
|
20
|
+
| `/om:auto` | 全自动执行 | 零交互,无审批,适合批量任务 |
|
|
21
|
+
| `/om:debug` | 系统化调试 | 问题诊断,根因分析 |
|
|
22
|
+
| `/om:status` | 查看状态 | 任务执行进度 |
|
|
23
|
+
| `/om:meeting` | 处理阻塞 | 处理 blocked 任务 |
|
|
24
|
+
| `/om:report` | 生成报告 | 执行报告生成 |
|
|
25
|
+
| `/om:resume` | 恢复任务 | 恢复中断的任务 |
|
|
26
|
+
| `/om:research` | 领域调研 | 技术方案调研 |
|
|
27
|
+
|
|
28
|
+
## 快速开始
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
/om 实现用户登录功能
|
|
32
|
+
|
|
33
|
+
# AI 分析任务 → 推荐路由 → 用户确认 → 执行
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## 质量门禁
|
|
37
|
+
|
|
38
|
+
| 模式 | TDD | 覆盖率 | Lint | 安全扫描 |
|
|
39
|
+
|------|:---:|:------:|:----:|:--------:|
|
|
40
|
+
| 严格模式 | Y | >80% | Y | Y |
|
|
41
|
+
| 平衡模式 | N | >60% | Y | Y |
|
|
42
|
+
| 快速模式 | N | 无 | N | N |
|
|
43
|
+
|
|
44
|
+
## 安装
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install -g openmatrix
|
|
48
|
+
openmatrix install-skills
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## 文档
|
|
52
|
+
|
|
53
|
+
- GitHub: https://github.com/bigfish1913/openmatrix
|
|
54
|
+
- NPM: https://www.npmjs.com/package/openmatrix
|