@scottymade/mana 1.0.0
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 +53 -0
- package/bin/mana +48 -0
- package/package.json +43 -0
- package/scripts/postinstall.js +147 -0
package/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# @scottymade/mana
|
|
2
|
+
|
|
3
|
+
MANA - LLM Token Usage Optimizer for Claude Code
|
|
4
|
+
|
|
5
|
+
Optimizes token-heavy tool outputs, saving 50-80% on every operation. Double your Claude Code usage.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @scottymade/mana
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
After installing, you need to configure MANA for your project:
|
|
16
|
+
|
|
17
|
+
### 1. Get Your API Key
|
|
18
|
+
|
|
19
|
+
Sign up at [devmana.ai](https://devmana.ai) and create an API key.
|
|
20
|
+
|
|
21
|
+
### 2. Create `.mcp.json` in your project
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"mcpServers": {
|
|
26
|
+
"mana": {
|
|
27
|
+
"command": "mana",
|
|
28
|
+
"args": ["--api-key=YOUR_API_KEY"]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 3. Add Claude Instructions
|
|
35
|
+
|
|
36
|
+
Add the MANA instructions to `.claude/CLAUDE.md` in your project:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
mkdir -p .claude
|
|
40
|
+
curl -fsSL https://raw.githubusercontent.com/scottymade/mana/main/instructions/CLAUDE_INSTRUCTIONS.md >> .claude/CLAUDE.md
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 4. Restart Claude Code
|
|
44
|
+
|
|
45
|
+
Run `/mcp` to verify MANA is connected.
|
|
46
|
+
|
|
47
|
+
## Documentation
|
|
48
|
+
|
|
49
|
+
Full documentation at [github.com/scottymade/mana](https://github.com/scottymade/mana)
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
Apache-2.0
|
package/bin/mana
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# ============================================================================
|
|
3
|
+
# MANA MCP - Wrapper Script
|
|
4
|
+
# ============================================================================
|
|
5
|
+
# This script is the entry point for the mana command.
|
|
6
|
+
# It finds and executes the platform-specific binary that was downloaded
|
|
7
|
+
# during npm postinstall.
|
|
8
|
+
# ============================================================================
|
|
9
|
+
|
|
10
|
+
set -e
|
|
11
|
+
|
|
12
|
+
# Get the directory where this script is located
|
|
13
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
14
|
+
|
|
15
|
+
# Try to find the binary
|
|
16
|
+
# First, check for the symlink/copy created by postinstall
|
|
17
|
+
if [ -f "$SCRIPT_DIR/mana-binary" ]; then
|
|
18
|
+
exec "$SCRIPT_DIR/mana-binary" "$@"
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
# Fallback: detect platform and find the specific binary
|
|
22
|
+
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
23
|
+
ARCH=$(uname -m)
|
|
24
|
+
|
|
25
|
+
case "$ARCH" in
|
|
26
|
+
x86_64|amd64) ARCH="x64" ;;
|
|
27
|
+
arm64|aarch64) ARCH="arm64" ;;
|
|
28
|
+
esac
|
|
29
|
+
|
|
30
|
+
case "$OS" in
|
|
31
|
+
darwin) BINARY_NAME="mana-mcp-darwin-$ARCH" ;;
|
|
32
|
+
linux) BINARY_NAME="mana-mcp-linux-x64" ;;
|
|
33
|
+
*)
|
|
34
|
+
echo "Error: Unsupported OS: $OS" >&2
|
|
35
|
+
exit 1
|
|
36
|
+
;;
|
|
37
|
+
esac
|
|
38
|
+
|
|
39
|
+
BINARY_PATH="$SCRIPT_DIR/$BINARY_NAME"
|
|
40
|
+
|
|
41
|
+
if [ -f "$BINARY_PATH" ]; then
|
|
42
|
+
exec "$BINARY_PATH" "$@"
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
# Binary not found - postinstall may have failed
|
|
46
|
+
echo "Error: MANA binary not found at $BINARY_PATH" >&2
|
|
47
|
+
echo "Try reinstalling: npm install -g @scottymade/mana" >&2
|
|
48
|
+
exit 1
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@scottymade/mana",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "MANA - LLM Token Usage Optimizer for Claude Code",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"claude",
|
|
7
|
+
"claude-code",
|
|
8
|
+
"mcp",
|
|
9
|
+
"token-optimization",
|
|
10
|
+
"llm"
|
|
11
|
+
],
|
|
12
|
+
"author": "ScottyMade <hi@scottymadellc.com>",
|
|
13
|
+
"license": "Apache-2.0",
|
|
14
|
+
"homepage": "https://devmana.ai",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/scottymade/mana"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/scottymade/mana/issues"
|
|
21
|
+
},
|
|
22
|
+
"bin": {
|
|
23
|
+
"mana": "./bin/mana"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"postinstall": "node scripts/postinstall.js"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=16"
|
|
30
|
+
},
|
|
31
|
+
"os": [
|
|
32
|
+
"darwin",
|
|
33
|
+
"linux"
|
|
34
|
+
],
|
|
35
|
+
"cpu": [
|
|
36
|
+
"x64",
|
|
37
|
+
"arm64"
|
|
38
|
+
],
|
|
39
|
+
"files": [
|
|
40
|
+
"bin/",
|
|
41
|
+
"scripts/"
|
|
42
|
+
]
|
|
43
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// ============================================================================
|
|
3
|
+
// MANA MCP - Postinstall Script
|
|
4
|
+
// ============================================================================
|
|
5
|
+
// This script runs after `npm install` and downloads the correct binary
|
|
6
|
+
// for the user's operating system and architecture.
|
|
7
|
+
//
|
|
8
|
+
// Supported platforms:
|
|
9
|
+
// - macOS (darwin) arm64 (M1/M2/M3)
|
|
10
|
+
// - macOS (darwin) x64 (Intel)
|
|
11
|
+
// - Linux x64
|
|
12
|
+
// ============================================================================
|
|
13
|
+
|
|
14
|
+
const https = require('https');
|
|
15
|
+
const fs = require('fs');
|
|
16
|
+
const path = require('path');
|
|
17
|
+
const { execSync } = require('child_process');
|
|
18
|
+
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// Configuration
|
|
21
|
+
// ============================================================================
|
|
22
|
+
|
|
23
|
+
const REPO = 'scottymade/mana';
|
|
24
|
+
const GITHUB_RELEASES_URL = `https://github.com/${REPO}/releases/latest/download`;
|
|
25
|
+
|
|
26
|
+
// Map of platform/arch to binary name
|
|
27
|
+
const BINARY_MAP = {
|
|
28
|
+
'darwin-arm64': 'mana-mcp-darwin-arm64',
|
|
29
|
+
'darwin-x64': 'mana-mcp-darwin-x64',
|
|
30
|
+
'linux-x64': 'mana-mcp-linux-x64',
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// ============================================================================
|
|
34
|
+
// Helper Functions
|
|
35
|
+
// ============================================================================
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Get the binary name for the current platform
|
|
39
|
+
*/
|
|
40
|
+
function getBinaryName() {
|
|
41
|
+
const platform = process.platform;
|
|
42
|
+
const arch = process.arch;
|
|
43
|
+
const key = `${platform}-${arch}`;
|
|
44
|
+
|
|
45
|
+
const binaryName = BINARY_MAP[key];
|
|
46
|
+
|
|
47
|
+
if (!binaryName) {
|
|
48
|
+
console.error(`\nError: Unsupported platform: ${platform}-${arch}`);
|
|
49
|
+
console.error('MANA supports: macOS (arm64, x64), Linux (x64)\n');
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return binaryName;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Download a file from URL to destination
|
|
58
|
+
* Follows redirects (GitHub releases redirect to S3)
|
|
59
|
+
*/
|
|
60
|
+
function downloadFile(url, dest) {
|
|
61
|
+
return new Promise((resolve, reject) => {
|
|
62
|
+
const file = fs.createWriteStream(dest);
|
|
63
|
+
|
|
64
|
+
const request = (url) => {
|
|
65
|
+
https.get(url, (response) => {
|
|
66
|
+
// Handle redirects (GitHub releases return 302)
|
|
67
|
+
if (response.statusCode === 301 || response.statusCode === 302) {
|
|
68
|
+
const redirectUrl = response.headers.location;
|
|
69
|
+
request(redirectUrl);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (response.statusCode !== 200) {
|
|
74
|
+
reject(new Error(`Failed to download: HTTP ${response.statusCode}`));
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
response.pipe(file);
|
|
79
|
+
|
|
80
|
+
file.on('finish', () => {
|
|
81
|
+
file.close();
|
|
82
|
+
resolve();
|
|
83
|
+
});
|
|
84
|
+
}).on('error', (err) => {
|
|
85
|
+
fs.unlink(dest, () => {}); // Delete partial file
|
|
86
|
+
reject(err);
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
request(url);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// ============================================================================
|
|
95
|
+
// Main
|
|
96
|
+
// ============================================================================
|
|
97
|
+
|
|
98
|
+
async function main() {
|
|
99
|
+
const binaryName = getBinaryName();
|
|
100
|
+
const downloadUrl = `${GITHUB_RELEASES_URL}/${binaryName}`;
|
|
101
|
+
const binDir = path.join(__dirname, '..', 'bin');
|
|
102
|
+
const binaryPath = path.join(binDir, binaryName);
|
|
103
|
+
|
|
104
|
+
console.log(`\nMANA: Installing ${binaryName}...`);
|
|
105
|
+
|
|
106
|
+
// Ensure bin directory exists
|
|
107
|
+
if (!fs.existsSync(binDir)) {
|
|
108
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Download the binary
|
|
112
|
+
try {
|
|
113
|
+
await downloadFile(downloadUrl, binaryPath);
|
|
114
|
+
} catch (error) {
|
|
115
|
+
console.error(`\nError downloading MANA binary: ${error.message}`);
|
|
116
|
+
console.error(`URL: ${downloadUrl}\n`);
|
|
117
|
+
process.exit(1);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Make it executable
|
|
121
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
122
|
+
|
|
123
|
+
// Create a symlink or copy as 'mana-binary' so the wrapper can find it
|
|
124
|
+
const symlinkPath = path.join(binDir, 'mana-binary');
|
|
125
|
+
try {
|
|
126
|
+
if (fs.existsSync(symlinkPath)) {
|
|
127
|
+
fs.unlinkSync(symlinkPath);
|
|
128
|
+
}
|
|
129
|
+
// Use copy instead of symlink for better cross-platform support
|
|
130
|
+
fs.copyFileSync(binaryPath, symlinkPath);
|
|
131
|
+
fs.chmodSync(symlinkPath, 0o755);
|
|
132
|
+
} catch (error) {
|
|
133
|
+
// If copy fails, the wrapper will fall back to detecting the binary
|
|
134
|
+
console.warn(`Warning: Could not create binary link: ${error.message}`);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
console.log('MANA: Installation complete!\n');
|
|
138
|
+
console.log('Next steps:');
|
|
139
|
+
console.log(' 1. Create .mcp.json in your project (see README)');
|
|
140
|
+
console.log(' 2. Add MANA instructions to .claude/CLAUDE.md');
|
|
141
|
+
console.log(' 3. Restart Claude Code\n');
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
main().catch((error) => {
|
|
145
|
+
console.error('MANA installation failed:', error.message);
|
|
146
|
+
process.exit(1);
|
|
147
|
+
});
|