uncompact 0.46.5 → 0.46.7

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.
Files changed (2) hide show
  1. package/npm/install.js +20 -14
  2. package/package.json +1 -1
package/npm/install.js CHANGED
@@ -111,14 +111,15 @@ function extractZip(buffer, destDir, binaryName) {
111
111
 
112
112
  function log(msg) {
113
113
  process.stderr.write(msg);
114
- try {
115
- if (process.platform !== "win32" && process.stdout.isTTY) {
114
+ // Only write to /dev/tty if stderr is NOT a TTY, to avoid double-logging
115
+ if (!process.stderr.isTTY && process.platform !== "win32") {
116
+ try {
116
117
  const tty = fs.openSync("/dev/tty", "w");
117
118
  fs.writeSync(tty, msg);
118
119
  fs.closeSync(tty);
120
+ } catch (err) {
121
+ // Ignore TTY errors
119
122
  }
120
- } catch (err) {
121
- // Ignore TTY errors
122
123
  }
123
124
  }
124
125
 
@@ -204,22 +205,27 @@ async function main() {
204
205
  execFileSync(destPath, ["status"], { stdio: "inherit" });
205
206
 
206
207
  // If not authenticated, take them to the next step automatically
207
- const config = require(path.join(__dirname, "..", "package.json")); // Need version check logic? No, just use binary
208
- const checkAuthCmd = `"${destPath}" auth status`;
209
- try {
210
- const authStatus = execSync(checkAuthCmd).toString();
211
- if (authStatus.includes("Status: not authenticated") || authStatus.includes("✗")) {
212
- log("\n[uncompact] Authentication required. Starting login flow...\n");
208
+ // Only attempt interactive login if we are in a terminal (TTY)
209
+ if (process.stdin.isTTY) {
210
+ const checkAuthCmd = `"${destPath}" auth status`;
211
+ try {
212
+ const authStatus = execSync(checkAuthCmd).toString();
213
+ if (authStatus.includes("Status: not authenticated") || authStatus.includes("✗")) {
214
+ log("\n[uncompact] Authentication required. Starting login flow...\n");
213
215
  try {
214
216
  // Use 'auth login' which opens browser AND prompts for key
215
217
  execFileSync(destPath, ["auth", "login"], { stdio: "inherit" });
216
218
  log("\n[uncompact] Login successful.\n");
217
219
  } catch (err) {
218
- log(`\n[uncompact] Login process exited: ${err.message}\n`);
219
- log("[uncompact] You can run it manually later: uncompact auth login\n");
220
+ // Command failed (e.g. invalid key, 402, or user cancelled)
221
+ // We don't print the error message here because 'inherit' already showed it
222
+ log("\n[uncompact] Login incomplete or failed. You can run it manually later: uncompact auth login\n");
220
223
  }
221
- }
222
- } catch (e) {}
224
+ }
225
+ } catch (e) {}
226
+ } else {
227
+ log("\n[uncompact] Authentication required. Run 'uncompact auth login' to connect your account.\n");
228
+ }
223
229
  } catch (err) {
224
230
  // If status fails, show help as a fallback if we haven't shown anything yet
225
231
  if (!installSuccessful) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uncompact",
3
- "version": "0.46.5",
3
+ "version": "0.46.7",
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",