uncompact 0.45.2 → 0.45.8
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 +22 -2
- package/npm/install.js +64 -57
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -70,15 +70,35 @@ env:
|
|
|
70
70
|
**Via npm (recommended):**
|
|
71
71
|
|
|
72
72
|
```bash
|
|
73
|
+
# Install CLI and automatically configure Claude Code hooks
|
|
73
74
|
npm install -g uncompact
|
|
74
75
|
```
|
|
75
76
|
|
|
76
|
-
|
|
77
|
+
*Note: npm might hide the configuration output. You can verify the installation with `uncompact verify-install`.*
|
|
78
|
+
|
|
79
|
+
**Or run/install without global installation:**
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# This will show full interactive output
|
|
83
|
+
npx uncompact install
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 🗑 Uninstall
|
|
87
|
+
|
|
88
|
+
To remove the Claude Code hooks only:
|
|
77
89
|
|
|
78
90
|
```bash
|
|
79
|
-
|
|
91
|
+
uncompact uninstall
|
|
80
92
|
```
|
|
81
93
|
|
|
94
|
+
To **completely remove** Uncompact configuration and cached data:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
uncompact uninstall --total
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
*Note: After running the above, you can remove the CLI itself with `npm uninstall -g uncompact`.*
|
|
101
|
+
|
|
82
102
|
**Via Go:**
|
|
83
103
|
|
|
84
104
|
```bash
|
package/npm/install.js
CHANGED
|
@@ -109,6 +109,19 @@ function extractZip(buffer, destDir, binaryName) {
|
|
|
109
109
|
return extracted;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
function log(msg) {
|
|
113
|
+
process.stderr.write(msg);
|
|
114
|
+
try {
|
|
115
|
+
if (process.platform !== "win32" && process.stdout.isTTY) {
|
|
116
|
+
const tty = fs.openSync("/dev/tty", "w");
|
|
117
|
+
fs.writeSync(tty, msg);
|
|
118
|
+
fs.closeSync(tty);
|
|
119
|
+
}
|
|
120
|
+
} catch (err) {
|
|
121
|
+
// Ignore TTY errors
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
112
125
|
async function main() {
|
|
113
126
|
const platform = getPlatform();
|
|
114
127
|
const arch = getArch();
|
|
@@ -116,7 +129,7 @@ async function main() {
|
|
|
116
129
|
const binaryName = getBinaryName(platform);
|
|
117
130
|
const binDir = path.join(__dirname, "bin");
|
|
118
131
|
|
|
119
|
-
|
|
132
|
+
log(`[uncompact] Post-install setup for ${platform}/${arch}...\n`);
|
|
120
133
|
|
|
121
134
|
if (!fs.existsSync(binDir)) {
|
|
122
135
|
fs.mkdirSync(binDir, { recursive: true });
|
|
@@ -124,76 +137,70 @@ async function main() {
|
|
|
124
137
|
|
|
125
138
|
const destPath = path.join(binDir, binaryName);
|
|
126
139
|
|
|
127
|
-
if (fs.existsSync(destPath)) {
|
|
128
|
-
|
|
129
|
-
|
|
140
|
+
if (!fs.existsSync(destPath)) {
|
|
141
|
+
const version = getPackageVersion();
|
|
142
|
+
let release;
|
|
143
|
+
try {
|
|
144
|
+
release = await getRelease(version);
|
|
145
|
+
} catch (err) {
|
|
146
|
+
log(`[uncompact] Failed to fetch release: ${err.message}\n`);
|
|
147
|
+
log(`[uncompact] You can install manually: go install github.com/${REPO_OWNER}/${REPO_NAME.toLowerCase()}@latest\n`);
|
|
148
|
+
process.exit(0);
|
|
149
|
+
}
|
|
130
150
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
process.exit(0);
|
|
139
|
-
}
|
|
151
|
+
const asset = release.assets.find((a) => a.name === assetName);
|
|
152
|
+
if (!asset) {
|
|
153
|
+
log(`[uncompact] No binary found for ${platform}/${arch} in release ${release.tag_name}\n`);
|
|
154
|
+
log(`[uncompact] Available assets: ${release.assets.map((a) => a.name).join(", ")}\n`);
|
|
155
|
+
log(`[uncompact] You can install manually: go install github.com/${REPO_OWNER}/${REPO_NAME.toLowerCase()}@latest\n`);
|
|
156
|
+
process.exit(0);
|
|
157
|
+
}
|
|
140
158
|
|
|
141
|
-
|
|
142
|
-
if (!asset) {
|
|
143
|
-
process.stderr.write(`[uncompact] No binary found for ${platform}/${arch} in release ${release.tag_name}\n`);
|
|
144
|
-
process.stderr.write(`[uncompact] Available assets: ${release.assets.map((a) => a.name).join(", ")}\n`);
|
|
145
|
-
process.stderr.write(`[uncompact] You can install manually: go install github.com/${REPO_OWNER}/${REPO_NAME.toLowerCase()}@latest\n`);
|
|
146
|
-
process.exit(0);
|
|
147
|
-
}
|
|
159
|
+
log(`[uncompact] Downloading ${BINARY_NAME} ${release.tag_name}...\n`);
|
|
148
160
|
|
|
149
|
-
|
|
150
|
-
|
|
161
|
+
let buffer;
|
|
162
|
+
try {
|
|
163
|
+
buffer = await httpsGet(asset.browser_download_url);
|
|
164
|
+
} catch (err) {
|
|
165
|
+
log(`[uncompact] Failed to download: ${err.message}\n`);
|
|
166
|
+
process.exit(0);
|
|
167
|
+
}
|
|
151
168
|
|
|
152
|
-
|
|
153
|
-
try {
|
|
154
|
-
buffer = await httpsGet(asset.browser_download_url);
|
|
155
|
-
} catch (err) {
|
|
156
|
-
process.stderr.write(`[uncompact] Failed to download: ${err.message}\n`);
|
|
157
|
-
process.exit(0);
|
|
158
|
-
}
|
|
169
|
+
log(`[uncompact] Extracting...\n`);
|
|
159
170
|
|
|
160
|
-
|
|
171
|
+
try {
|
|
172
|
+
if (platform === "windows") {
|
|
173
|
+
extractZip(buffer, binDir, binaryName);
|
|
174
|
+
} else {
|
|
175
|
+
extractTarGz(buffer, binDir, binaryName);
|
|
176
|
+
}
|
|
177
|
+
} catch (err) {
|
|
178
|
+
log(`[uncompact] Failed to extract: ${err.message}\n`);
|
|
179
|
+
process.exit(0);
|
|
180
|
+
}
|
|
161
181
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
extractZip(buffer, binDir, binaryName);
|
|
165
|
-
} else {
|
|
166
|
-
extractTarGz(buffer, binDir, binaryName);
|
|
182
|
+
if (platform !== "windows") {
|
|
183
|
+
fs.chmodSync(destPath, 0o755);
|
|
167
184
|
}
|
|
168
|
-
} catch (err) {
|
|
169
|
-
process.stderr.write(`[uncompact] Failed to extract: ${err.message}\n`);
|
|
170
|
-
process.exit(0);
|
|
171
|
-
}
|
|
172
185
|
|
|
173
|
-
|
|
174
|
-
fs.chmodSync(destPath, 0o755);
|
|
186
|
+
log(`[uncompact] Installed to ${destPath}\n\n`);
|
|
175
187
|
}
|
|
176
188
|
|
|
177
|
-
process.stderr.write(`[uncompact] Installed to ${destPath}\n\n`);
|
|
178
|
-
|
|
179
189
|
// Automatically install Claude Code hooks
|
|
180
|
-
|
|
181
|
-
try {
|
|
182
|
-
// We redirect stdout to stderr to ensure visibility during npm install
|
|
183
|
-
execFileSync(destPath, ["install", "--yes"], { stdio: ["inherit", process.stderr, "inherit"] });
|
|
184
|
-
} catch (err) {
|
|
185
|
-
process.stderr.write("[uncompact] Failed to automatically configure hooks. You can run it manually:\n");
|
|
186
|
-
process.stderr.write(" uncompact install\n");
|
|
187
|
-
}
|
|
188
|
-
process.stderr.write("\n");
|
|
189
|
-
|
|
190
|
-
// Show help output after install
|
|
190
|
+
log("[uncompact] Configuring Claude Code hooks...\n");
|
|
191
191
|
try {
|
|
192
|
-
//
|
|
193
|
-
execFileSync(destPath, [], { stdio:
|
|
192
|
+
// The 'install' command now automatically shows the help menu upon completion
|
|
193
|
+
execFileSync(destPath, ["install", "--yes"], { stdio: "inherit" });
|
|
194
194
|
} catch (err) {
|
|
195
|
-
|
|
195
|
+
log("[uncompact] Note: Automatic hook configuration skipped or failed. Run manually if needed:\n");
|
|
196
|
+
log(" uncompact install\n");
|
|
197
|
+
|
|
198
|
+
// Fallback: Show help if the install command failed
|
|
199
|
+
try {
|
|
200
|
+
execFileSync(destPath, [], { stdio: "inherit" });
|
|
201
|
+
} catch (e) {}
|
|
196
202
|
}
|
|
203
|
+
log("\n");
|
|
197
204
|
}
|
|
198
205
|
|
|
199
206
|
main().catch((err) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uncompact",
|
|
3
|
-
"version": "0.45.
|
|
3
|
+
"version": "0.45.8",
|
|
4
4
|
"description": "Stop Claude Code compaction from making your AI stupid. Re-inject project context after compaction via the Supermodel API.",
|
|
5
5
|
"author": "Supermodel <abe@supermodel.software>",
|
|
6
6
|
"license": "MIT",
|