uncompact 0.46.7 → 0.48.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.
Files changed (3) hide show
  1. package/README.md +23 -42
  2. package/npm/install.js +20 -42
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -50,7 +50,7 @@ This installs both hooks automatically:
50
50
  - **`SessionStart`** — runs `scripts/setup.sh` which auto-installs the `uncompact` binary via `go install` if not already present.
51
51
  - **`Stop`** — runs `scripts/uncompact-hook.sh` which reinjects context after every compaction event.
52
52
 
53
- > **Note:** After plugin installation, authenticate once with `uncompact auth login` to connect your Supermodel API key. That's it — no manual binary install or hook setup required.
53
+ > **Note:** After plugin installation, run `uncompact auth login` once to authenticate. This also ensures hooks are installed — no separate `uncompact install` step needed.
54
54
 
55
55
  ### CI / GitHub Actions
56
56
 
@@ -65,69 +65,48 @@ env:
65
65
 
66
66
  ## Quick Start
67
67
 
68
- ### 1. Install
69
-
70
- **Via npm (recommended):**
71
-
72
- ```bash
73
- # Install CLI and automatically configure Claude Code hooks
74
- npm install -g uncompact
75
- ```
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:
68
+ ### Via npm (recommended)
89
69
 
90
70
  ```bash
91
- uncompact uninstall
71
+ npm install -g uncompact --foreground-scripts
92
72
  ```
93
73
 
94
- To **completely remove** Uncompact configuration and cached data:
95
-
96
- ```bash
97
- uncompact uninstall --total
98
- ```
74
+ That's it. The installer downloads the binary, opens your browser for GitHub authentication, and installs the Claude Code hooks — all in one step.
99
75
 
100
- *Note: After running the above, you can remove the CLI itself with `npm uninstall -g uncompact`.*
76
+ > `--foreground-scripts` is required so the interactive auth prompt is visible in your terminal.
101
77
 
102
- **Via Go:**
78
+ ### Via Go or manual binary
103
79
 
104
80
  ```bash
105
81
  go install github.com/supermodeltools/uncompact@latest
82
+ # then:
83
+ uncompact auth login
106
84
  ```
107
85
 
108
- **Or download a binary** from [Releases](https://github.com/supermodeltools/Uncompact/releases).
86
+ `auth login` opens your browser for GitHub OAuth, saves your API key, and installs the Claude Code hooks automatically.
109
87
 
110
- ### 2. Authenticate
88
+ **Or download a binary** from [Releases](https://github.com/supermodeltools/Uncompact/releases) and run `uncompact auth login`.
89
+
90
+ ### Verify
111
91
 
112
92
  ```bash
113
- uncompact auth login
93
+ uncompact verify-install
94
+ uncompact run --debug
114
95
  ```
115
96
 
116
- This opens [dashboard.supermodeltools.com/api-keys/](https://dashboard.supermodeltools.com/api-keys/) where you can subscribe and generate an API key.
97
+ ### 🗑 Uninstall
117
98
 
118
- ### 3. Install Claude Code Hooks
99
+ To remove the Claude Code hooks only:
119
100
 
120
101
  ```bash
121
- uncompact install
102
+ uncompact uninstall
122
103
  ```
123
104
 
124
- This auto-detects your Claude Code `settings.json`, shows a diff, and merges the hooks non-destructively.
125
-
126
- ### 4. Verify
105
+ To **completely remove** Uncompact configuration and cached data:
127
106
 
128
107
  ```bash
129
- uncompact verify-install
130
- uncompact run --debug
108
+ uncompact uninstall --total
109
+ npm uninstall -g uncompact
131
110
  ```
132
111
 
133
112
  ## CLI Reference
@@ -164,6 +143,8 @@ uncompact cache clear --project # Clear only the current project's cache
164
143
  | Variable | Description |
165
144
  |----------|-------------|
166
145
  | `SUPERMODEL_API_KEY` | Supermodel API key (overrides config file) |
146
+ | `UNCOMPACT_API_URL` | Override the API base URL (e.g. for staging) |
147
+ | `UNCOMPACT_DASHBOARD_URL` | Override the dashboard base URL (e.g. for staging) |
167
148
 
168
149
  ### Config File
169
150
 
@@ -244,7 +225,7 @@ uncompact/
244
225
  |---------|--------|
245
226
  | Default TTL | 15 minutes |
246
227
  | Stale cache | Served with `⚠️ STALE` warning; fresh fetch attempted |
247
- | API unavailable | Serve most recent cache entry silently |
228
+ | API unreachable | Fail fast on connection error; serve stale cache if available |
248
229
  | No cache + API down | Silent exit 0 (never blocks Claude Code) |
249
230
  | Storage growth | Auto-prune entries older than 30 days |
250
231
  | Force refresh | `--force-refresh` flag |
package/npm/install.js CHANGED
@@ -3,7 +3,7 @@
3
3
  const https = require("https");
4
4
  const fs = require("fs");
5
5
  const path = require("path");
6
- const { execSync, execFileSync } = require("child_process");
6
+ const { execFileSync } = require("child_process");
7
7
  const os = require("os");
8
8
 
9
9
  const REPO_OWNER = "supermodeltools";
@@ -187,54 +187,32 @@ async function main() {
187
187
  log(`[uncompact] Installed to ${destPath}\n\n`);
188
188
  }
189
189
 
190
- // Automatically install Claude Code hooks
191
- log("[uncompact] Configuring Claude Code hooks...\n");
192
- let installSuccessful = false;
190
+ // Check if already authenticated so we can decide what to run.
191
+ let isAuthenticated = false;
193
192
  try {
194
- // The 'install' command now automatically shows the help menu upon completion
195
- execFileSync(destPath, ["install", "--yes"], { stdio: "inherit" });
196
- installSuccessful = true;
193
+ const out = execFileSync(destPath, ["auth", "status"], { stdio: "pipe" }).toString();
194
+ isAuthenticated = out.includes("authenticated");
197
195
  } catch (err) {
198
- log("[uncompact] Note: Automatic hook configuration skipped or failed. Run manually if needed:\n");
199
- log(" uncompact install\n");
196
+ // binary failed or not runnable fall through to install
200
197
  }
201
198
 
202
- // Always show status to verify API key detection, regardless of install success
203
- try {
204
- console.log();
205
- execFileSync(destPath, ["status"], { stdio: "inherit" });
206
-
207
- // If not authenticated, take them to the next step automatically
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");
215
- try {
216
- // Use 'auth login' which opens browser AND prompts for key
217
- execFileSync(destPath, ["auth", "login"], { stdio: "inherit" });
218
- log("\n[uncompact] Login successful.\n");
219
- } catch (err) {
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");
223
- }
224
- }
225
- } catch (e) {}
226
- } else {
227
- log("\n[uncompact] Authentication required. Run 'uncompact auth login' to connect your account.\n");
199
+ if (isAuthenticated) {
200
+ // Existing user (upgrade): just make sure hooks are current.
201
+ log("[uncompact] Already authenticated. Ensuring Claude Code hooks are installed...\n");
202
+ try {
203
+ execFileSync(destPath, ["install", "--yes"], { stdio: "inherit" });
204
+ } catch (err) {
205
+ log("[uncompact] Note: hook configuration skipped. Run 'uncompact install' manually if needed.\n");
228
206
  }
229
- } catch (err) {
230
- // If status fails, show help as a fallback if we haven't shown anything yet
231
- if (!installSuccessful) {
232
- try {
233
- execFileSync(destPath, [], { stdio: "inherit" });
234
- } catch (e) {}
207
+ } else {
208
+ // Fresh install: auth login handles both authentication and hook installation.
209
+ log("[uncompact] Starting setup...\n\n");
210
+ try {
211
+ execFileSync(destPath, ["auth", "login"], { stdio: "inherit" });
212
+ } catch (err) {
213
+ log("[uncompact] Setup skipped or failed. Run 'uncompact auth login' to complete setup.\n");
235
214
  }
236
215
  }
237
- log("\n");
238
216
  }
239
217
 
240
218
  main().catch((err) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uncompact",
3
- "version": "0.46.7",
3
+ "version": "0.48.0",
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",