openmatrix 0.2.28 ā 0.2.29
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 +101 -79
- package/package.json +1 -1
- package/scripts/install-skills.js +13 -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,124 @@ 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
|
+
console.log(` ā
Installed: ${installed}`);
|
|
150
|
+
console.log(` āļø Skipped: ${skipped}`);
|
|
151
|
+
if (failed > 0) {
|
|
152
|
+
console.log(` ā Failed: ${failed}`);
|
|
137
153
|
}
|
|
154
|
+
totalInstalled += installed;
|
|
155
|
+
totalSkipped += skipped;
|
|
156
|
+
totalFailed += failed;
|
|
138
157
|
}
|
|
139
158
|
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
|
-
|
|
159
|
+
console.log(`š Total Summary:`);
|
|
160
|
+
console.log(` ā
Installed: ${totalInstalled}`);
|
|
161
|
+
console.log(` āļø Skipped: ${totalSkipped}`);
|
|
162
|
+
console.log(` ā Failed: ${totalFailed}`);
|
|
163
|
+
console.log('\nš Installation locations:');
|
|
164
|
+
for (const target of targets) {
|
|
165
|
+
if (target.enabled) {
|
|
166
|
+
console.log(` ${target.name}: ${target.dir}`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (totalInstalled > 0) {
|
|
147
170
|
console.log('\nš Skills installed successfully!');
|
|
148
171
|
console.log(' Try: /om <your task>');
|
|
149
172
|
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
173
|
}
|
|
155
|
-
if (
|
|
174
|
+
if (hasMatrixCode) {
|
|
175
|
+
console.log('\nā
MatrixCode detected! Skills also installed to ~/.matrix/skills/om/');
|
|
176
|
+
}
|
|
177
|
+
if (totalFailed > 0) {
|
|
156
178
|
process.exit(1);
|
|
157
179
|
}
|
|
158
180
|
});
|
package/package.json
CHANGED
|
@@ -23,6 +23,19 @@ const targets = [
|
|
|
23
23
|
},
|
|
24
24
|
];
|
|
25
25
|
|
|
26
|
+
// Check for MatrixCode installation
|
|
27
|
+
// MatrixCode uses ~/.matrix/ directory for configuration
|
|
28
|
+
const matrixDir = path.join(os.homedir(), '.matrix');
|
|
29
|
+
const matrixSkillsDir = path.join(matrixDir, 'skills', 'om');
|
|
30
|
+
|
|
31
|
+
// If ~/.matrix/ exists, add MatrixCode as a target
|
|
32
|
+
if (fs.existsSync(matrixDir)) {
|
|
33
|
+
targets.push({
|
|
34
|
+
name: 'MatrixCode',
|
|
35
|
+
dir: matrixSkillsDir,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
26
39
|
if (!fs.existsSync(skillsDir)) {
|
|
27
40
|
console.log('Skills directory not found, skipping installation.');
|
|
28
41
|
process.exit(0);
|