@alucardeht/claude-memory 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/bin/claude-memory +12 -0
- package/install.js +127 -0
- package/package.json +41 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
3
|
+
|
|
4
|
+
if [ -f "$SCRIPT_DIR/claude-memory.exe" ]; then
|
|
5
|
+
exec "$SCRIPT_DIR/claude-memory.exe" "$@"
|
|
6
|
+
elif [ -f "$SCRIPT_DIR/../claude-memory" ]; then
|
|
7
|
+
exec "$SCRIPT_DIR/../claude-memory" "$@"
|
|
8
|
+
else
|
|
9
|
+
echo "Error: claude-memory binary not found" >&2
|
|
10
|
+
echo "Try reinstalling: npm install -g claude-memory" >&2
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
package/install.js
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execSync, spawn } = require('child_process');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const https = require('https');
|
|
7
|
+
const os = require('os');
|
|
8
|
+
|
|
9
|
+
const VERSION = require('./package.json').version;
|
|
10
|
+
const REPO = 'user/claude-memory';
|
|
11
|
+
|
|
12
|
+
function getPlatform() {
|
|
13
|
+
const platform = os.platform();
|
|
14
|
+
const arch = os.arch();
|
|
15
|
+
|
|
16
|
+
const platformMap = {
|
|
17
|
+
darwin: 'darwin',
|
|
18
|
+
linux: 'linux',
|
|
19
|
+
win32: 'windows',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const archMap = {
|
|
23
|
+
x64: 'amd64',
|
|
24
|
+
arm64: 'arm64',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const p = platformMap[platform];
|
|
28
|
+
const a = archMap[arch];
|
|
29
|
+
|
|
30
|
+
if (!p || !a) {
|
|
31
|
+
throw new Error(`Unsupported platform: ${platform}-${arch}`);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return { platform: p, arch: a };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function getBinaryName() {
|
|
38
|
+
const { platform, arch } = getPlatform();
|
|
39
|
+
const ext = platform === 'windows' ? '.exe' : '';
|
|
40
|
+
return `claude-memory-${platform}-${arch}${ext}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function getDownloadUrl() {
|
|
44
|
+
const binaryName = getBinaryName();
|
|
45
|
+
return `https://github.com/${REPO}/releases/download/v${VERSION}/${binaryName}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function download(url, dest) {
|
|
49
|
+
return new Promise((resolve, reject) => {
|
|
50
|
+
const file = fs.createWriteStream(dest);
|
|
51
|
+
|
|
52
|
+
const request = (url) => {
|
|
53
|
+
https.get(url, (response) => {
|
|
54
|
+
if (response.statusCode === 302 || response.statusCode === 301) {
|
|
55
|
+
request(response.headers.location);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (response.statusCode !== 200) {
|
|
60
|
+
reject(new Error(`Failed to download: ${response.statusCode}`));
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
response.pipe(file);
|
|
65
|
+
file.on('finish', () => {
|
|
66
|
+
file.close();
|
|
67
|
+
resolve();
|
|
68
|
+
});
|
|
69
|
+
}).on('error', (err) => {
|
|
70
|
+
fs.unlink(dest, () => {});
|
|
71
|
+
reject(err);
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
request(url);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async function main() {
|
|
80
|
+
const binDir = path.join(__dirname, 'bin');
|
|
81
|
+
const { platform } = getPlatform();
|
|
82
|
+
const binaryName = platform === 'windows' ? 'claude-memory.exe' : 'claude-memory';
|
|
83
|
+
const binaryPath = path.join(binDir, binaryName);
|
|
84
|
+
|
|
85
|
+
if (!fs.existsSync(binDir)) {
|
|
86
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const url = getDownloadUrl();
|
|
90
|
+
console.log(`Downloading claude-memory from ${url}...`);
|
|
91
|
+
|
|
92
|
+
try {
|
|
93
|
+
await download(url, binaryPath);
|
|
94
|
+
} catch (err) {
|
|
95
|
+
console.error(`Failed to download binary: ${err.message}`);
|
|
96
|
+
console.error('');
|
|
97
|
+
console.error('You can manually install by:');
|
|
98
|
+
console.error('1. Download from: https://github.com/' + REPO + '/releases');
|
|
99
|
+
console.error('2. Place the binary in your PATH');
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (platform !== 'windows') {
|
|
104
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
console.log('Binary installed successfully!');
|
|
108
|
+
console.log('');
|
|
109
|
+
|
|
110
|
+
console.log('Configuring Claude Code hooks...');
|
|
111
|
+
try {
|
|
112
|
+
const result = spawn(binaryPath, ['install'], { stdio: 'inherit' });
|
|
113
|
+
result.on('close', (code) => {
|
|
114
|
+
if (code !== 0) {
|
|
115
|
+
console.error('Failed to configure hooks. Run "claude-memory install" manually.');
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
} catch (err) {
|
|
119
|
+
console.error('Failed to run install command:', err.message);
|
|
120
|
+
console.error('Run "claude-memory install" manually after installation.');
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
main().catch((err) => {
|
|
125
|
+
console.error('Installation failed:', err.message);
|
|
126
|
+
process.exit(1);
|
|
127
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@alucardeht/claude-memory",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Automatic context persistence for Claude Code",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"claude",
|
|
7
|
+
"claude-code",
|
|
8
|
+
"memory",
|
|
9
|
+
"context",
|
|
10
|
+
"ai",
|
|
11
|
+
"llm"
|
|
12
|
+
],
|
|
13
|
+
"author": "Your Name",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/alucardeht/claude-memory.git"
|
|
18
|
+
},
|
|
19
|
+
"bin": {
|
|
20
|
+
"claude-memory": "./bin/claude-memory"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"postinstall": "node install.js"
|
|
24
|
+
},
|
|
25
|
+
"os": [
|
|
26
|
+
"darwin",
|
|
27
|
+
"linux",
|
|
28
|
+
"win32"
|
|
29
|
+
],
|
|
30
|
+
"cpu": [
|
|
31
|
+
"x64",
|
|
32
|
+
"arm64"
|
|
33
|
+
],
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=14"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"bin",
|
|
39
|
+
"install.js"
|
|
40
|
+
]
|
|
41
|
+
}
|