@bigfishnpm/matrixcode 0.4.17 → 0.4.18
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/README.md +137 -33
- package/bin/matrixcode +5 -5
- package/package.json +1 -1
- package/scripts/download.js +93 -93
package/README.md
CHANGED
|
@@ -1,34 +1,138 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
AI coding assistant with multi-model support, context compression, and cross-session memory.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
matrixcode
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
# @bigfishnpm/matrixcode
|
|
2
|
+
|
|
3
|
+
AI coding assistant CLI with multi-model support, intelligent context compression, and cross-session memory.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @bigfishnpm/matrixcode
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The package automatically downloads the pre-built binary for your platform:
|
|
12
|
+
- Windows (x64)
|
|
13
|
+
- macOS (x64, arm64)
|
|
14
|
+
- Linux (x64, arm64)
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
### Interactive Terminal Mode
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
matrixcode
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Start an interactive terminal UI with:
|
|
25
|
+
- Streaming response rendering
|
|
26
|
+
- Markdown formatting
|
|
27
|
+
- Code syntax highlighting
|
|
28
|
+
- Tool call visualization
|
|
29
|
+
|
|
30
|
+
### One-shot Query
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
matrixcode "Analyze this project structure"
|
|
34
|
+
|
|
35
|
+
# JSON output mode (for scripting)
|
|
36
|
+
matrixcode --mode service "Explain this function"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Daemon Mode
|
|
40
|
+
|
|
41
|
+
For VS Code extension integration:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
matrixcode --mode daemon
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Send JSON requests via stdin:
|
|
48
|
+
```bash
|
|
49
|
+
echo '{"type":"chat","content":"test"}' | matrixcode --mode daemon
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Session Management
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# List previous sessions
|
|
56
|
+
matrixcode --list-sessions
|
|
57
|
+
|
|
58
|
+
# Resume a session
|
|
59
|
+
matrixcode --resume
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Configuration
|
|
63
|
+
|
|
64
|
+
Create `~/.matrix/config.json`:
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"provider": "anthropic",
|
|
69
|
+
"apiKey": "your-api-key",
|
|
70
|
+
"model": "claude-sonnet-4-20250514",
|
|
71
|
+
"maxTokens": 16384,
|
|
72
|
+
"think": true
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Or use environment variables:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
export PROVIDER=anthropic
|
|
80
|
+
export API_KEY=your-key
|
|
81
|
+
export MODEL=claude-sonnet-4-20250514
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Features
|
|
85
|
+
|
|
86
|
+
### 🤖 Multi-Model Support
|
|
87
|
+
- Anthropic Claude (Sonnet, Opus, Haiku)
|
|
88
|
+
- OpenAI GPT (GPT-4, GPT-3.5)
|
|
89
|
+
- Flexible model configuration for different tasks
|
|
90
|
+
|
|
91
|
+
### 🧠 Cross-Session Memory
|
|
92
|
+
- SQLite persistent storage
|
|
93
|
+
- Automatic memory extraction from conversations
|
|
94
|
+
- Keyword-triggered retrieval
|
|
95
|
+
- User preferences, project context, learning records
|
|
96
|
+
|
|
97
|
+
### 🗜️ Intelligent Context Compression
|
|
98
|
+
- Multi-phase compression strategy
|
|
99
|
+
- Dependency analysis and importance scoring
|
|
100
|
+
- Tool call result compression
|
|
101
|
+
- Session summarization
|
|
102
|
+
|
|
103
|
+
### 🔧 Rich Tool System
|
|
104
|
+
- File operations: read, write, edit, glob, grep
|
|
105
|
+
- Code execution: bash (sandboxed)
|
|
106
|
+
- Code intelligence: codegraph (tree-sitter based)
|
|
107
|
+
- Web capabilities: webfetch, websearch
|
|
108
|
+
- Task management: todo_write, task
|
|
109
|
+
|
|
110
|
+
### 📋 Workflow Engine
|
|
111
|
+
- YAML-defined workflows
|
|
112
|
+
- Multiple node types: AI, tool, condition, validate
|
|
113
|
+
- Failure strategies: retry, skip, fail, fallback
|
|
114
|
+
|
|
115
|
+
## CLI Options
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
matrixcode [OPTIONS] [MESSAGE]
|
|
119
|
+
|
|
120
|
+
Options:
|
|
121
|
+
--mode <MODE> Run mode: terminal, tui, service, json, daemon
|
|
122
|
+
--resume, -r Interactively select session to resume
|
|
123
|
+
--session <ID> Resume from specific session
|
|
124
|
+
--list-sessions List previous sessions
|
|
125
|
+
--config <PATH> Configuration file path
|
|
126
|
+
--help Show help
|
|
127
|
+
--version Show version
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Links
|
|
131
|
+
|
|
132
|
+
- [GitHub](https://github.com/bigfish1913/matrixcode)
|
|
133
|
+
- [Documentation](https://github.com/bigfish1913/matrixcode#readme)
|
|
134
|
+
- [VS Code Extension](https://marketplace.visualstudio.com/items?itemName=bigfish1913.matrixcode)
|
|
135
|
+
|
|
136
|
+
## License
|
|
137
|
+
|
|
34
138
|
MIT
|
package/bin/matrixcode
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
console.error('MatrixCode binary not found.');
|
|
4
|
-
console.error('Please install via cargo: cargo install matrixcode');
|
|
5
|
-
console.error('Or reinstall this package to download the binary.');
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
console.error('MatrixCode binary not found.');
|
|
4
|
+
console.error('Please install via cargo: cargo install matrixcode');
|
|
5
|
+
console.error('Or reinstall this package to download the binary.');
|
|
6
6
|
process.exit(1);
|
package/package.json
CHANGED
package/scripts/download.js
CHANGED
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const https = require('https');
|
|
4
|
-
const fs = require('fs');
|
|
5
|
-
const path = require('path');
|
|
6
|
-
const { execSync } = require('child_process');
|
|
7
|
-
|
|
8
|
-
const VERSION = require('./package.json').version;
|
|
9
|
-
const BIN_DIR = path.join(__dirname, 'bin');
|
|
10
|
-
const BIN_PATH = path.join(BIN_DIR, 'matrixcode');
|
|
11
|
-
|
|
12
|
-
// Determine platform and arch
|
|
13
|
-
const platform = process.platform;
|
|
14
|
-
const arch = process.arch;
|
|
15
|
-
|
|
16
|
-
// Map to release binary names
|
|
17
|
-
const binaryName = {
|
|
18
|
-
win32: { x64: 'matrixcode-windows-x64.exe', arm64: 'matrixcode-windows-arm64.exe' },
|
|
19
|
-
darwin: { x64: 'matrixcode-macos-x64', arm64: 'matrixcode-macos-arm64' },
|
|
20
|
-
linux: { x64: 'matrixcode-linux-x64', arm64: 'matrixcode-linux-arm64' }
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const binary = binaryName[platform]?.[arch];
|
|
24
|
-
if (!binary) {
|
|
25
|
-
console.error(`Unsupported platform: ${platform}-${arch}`);
|
|
26
|
-
process.exit(1);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// GitHub release URL
|
|
30
|
-
const downloadUrl = `https://github.com/bigfish1913/matrixcode/releases/download/v${VERSION}/${binary}`;
|
|
31
|
-
|
|
32
|
-
console.log(`Downloading matrixcode v${VERSION} for ${platform}-${arch}...`);
|
|
33
|
-
|
|
34
|
-
// Download function
|
|
35
|
-
function download(url, dest) {
|
|
36
|
-
return new Promise((resolve, reject) => {
|
|
37
|
-
const file = fs.createWriteStream(dest);
|
|
38
|
-
|
|
39
|
-
https.get(url, (response) => {
|
|
40
|
-
if (response.statusCode === 302 || response.statusCode === 301) {
|
|
41
|
-
// Follow redirect
|
|
42
|
-
download(response.headers.location, dest).then(resolve).catch(reject);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (response.statusCode !== 200) {
|
|
47
|
-
reject(new Error(`Download failed: ${response.statusCode}`));
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
response.pipe(file);
|
|
52
|
-
file.on('finish', () => {
|
|
53
|
-
file.close();
|
|
54
|
-
resolve();
|
|
55
|
-
});
|
|
56
|
-
}).on('error', (err) => {
|
|
57
|
-
fs.unlink(dest, () => {});
|
|
58
|
-
reject(err);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Main
|
|
64
|
-
async function main() {
|
|
65
|
-
try {
|
|
66
|
-
// Ensure bin directory exists
|
|
67
|
-
if (!fs.existsSync(BIN_DIR)) {
|
|
68
|
-
fs.mkdirSync(BIN_DIR, { recursive: true });
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Download binary
|
|
72
|
-
await download(downloadUrl, BIN_PATH);
|
|
73
|
-
|
|
74
|
-
// Make executable (Unix)
|
|
75
|
-
if (platform !== 'win32') {
|
|
76
|
-
fs.chmodSync(BIN_PATH, 0o755);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// On Windows, rename to .exe if needed
|
|
80
|
-
if (platform === 'win32' && !BIN_PATH.endsWith('.exe')) {
|
|
81
|
-
fs.renameSync(BIN_PATH, BIN_PATH + '.exe');
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
console.log('matrixcode installed successfully!');
|
|
85
|
-
console.log('Run: matrixcode --help');
|
|
86
|
-
} catch (err) {
|
|
87
|
-
console.error('Installation failed:', err.message);
|
|
88
|
-
console.error('\nYou can also install via cargo:');
|
|
89
|
-
console.error(' cargo install matrixcode');
|
|
90
|
-
process.exit(1);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const https = require('https');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const { execSync } = require('child_process');
|
|
7
|
+
|
|
8
|
+
const VERSION = require('./package.json').version;
|
|
9
|
+
const BIN_DIR = path.join(__dirname, 'bin');
|
|
10
|
+
const BIN_PATH = path.join(BIN_DIR, 'matrixcode');
|
|
11
|
+
|
|
12
|
+
// Determine platform and arch
|
|
13
|
+
const platform = process.platform;
|
|
14
|
+
const arch = process.arch;
|
|
15
|
+
|
|
16
|
+
// Map to release binary names
|
|
17
|
+
const binaryName = {
|
|
18
|
+
win32: { x64: 'matrixcode-windows-x64.exe', arm64: 'matrixcode-windows-arm64.exe' },
|
|
19
|
+
darwin: { x64: 'matrixcode-macos-x64', arm64: 'matrixcode-macos-arm64' },
|
|
20
|
+
linux: { x64: 'matrixcode-linux-x64', arm64: 'matrixcode-linux-arm64' }
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const binary = binaryName[platform]?.[arch];
|
|
24
|
+
if (!binary) {
|
|
25
|
+
console.error(`Unsupported platform: ${platform}-${arch}`);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// GitHub release URL
|
|
30
|
+
const downloadUrl = `https://github.com/bigfish1913/matrixcode/releases/download/v${VERSION}/${binary}`;
|
|
31
|
+
|
|
32
|
+
console.log(`Downloading matrixcode v${VERSION} for ${platform}-${arch}...`);
|
|
33
|
+
|
|
34
|
+
// Download function
|
|
35
|
+
function download(url, dest) {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
const file = fs.createWriteStream(dest);
|
|
38
|
+
|
|
39
|
+
https.get(url, (response) => {
|
|
40
|
+
if (response.statusCode === 302 || response.statusCode === 301) {
|
|
41
|
+
// Follow redirect
|
|
42
|
+
download(response.headers.location, dest).then(resolve).catch(reject);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (response.statusCode !== 200) {
|
|
47
|
+
reject(new Error(`Download failed: ${response.statusCode}`));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
response.pipe(file);
|
|
52
|
+
file.on('finish', () => {
|
|
53
|
+
file.close();
|
|
54
|
+
resolve();
|
|
55
|
+
});
|
|
56
|
+
}).on('error', (err) => {
|
|
57
|
+
fs.unlink(dest, () => {});
|
|
58
|
+
reject(err);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Main
|
|
64
|
+
async function main() {
|
|
65
|
+
try {
|
|
66
|
+
// Ensure bin directory exists
|
|
67
|
+
if (!fs.existsSync(BIN_DIR)) {
|
|
68
|
+
fs.mkdirSync(BIN_DIR, { recursive: true });
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Download binary
|
|
72
|
+
await download(downloadUrl, BIN_PATH);
|
|
73
|
+
|
|
74
|
+
// Make executable (Unix)
|
|
75
|
+
if (platform !== 'win32') {
|
|
76
|
+
fs.chmodSync(BIN_PATH, 0o755);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// On Windows, rename to .exe if needed
|
|
80
|
+
if (platform === 'win32' && !BIN_PATH.endsWith('.exe')) {
|
|
81
|
+
fs.renameSync(BIN_PATH, BIN_PATH + '.exe');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
console.log('matrixcode installed successfully!');
|
|
85
|
+
console.log('Run: matrixcode --help');
|
|
86
|
+
} catch (err) {
|
|
87
|
+
console.error('Installation failed:', err.message);
|
|
88
|
+
console.error('\nYou can also install via cargo:');
|
|
89
|
+
console.error(' cargo install matrixcode');
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
94
|
main();
|