replit-tools 1.0.4 → 1.0.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # DATA Tools
2
2
 
3
- **One command to set up Claude Code and Codex CLI on Replit with full persistence.**
3
+ **One command to set up Claude Code and Codex CLI on Replit with full persistence and automatic token refresh.**
4
4
 
5
5
  When Replit containers restart, everything outside `/home/runner/workspace/` is wiped - including installed CLIs, conversations, auth tokens, and command history. DATA Tools fixes all of that.
6
6
 
@@ -16,7 +16,8 @@ That's it. The installer will:
16
16
  2. **Install OpenAI Codex CLI** (if not already installed)
17
17
  3. **Detect existing config** and preserve your data
18
18
  4. **Set up persistence** so everything survives restarts
19
- 5. **Launch the session picker** so you can start working immediately
19
+ 5. **Auto-refresh OAuth tokens** before they expire
20
+ 6. **Launch the session picker** so you can start working immediately
20
21
 
21
22
  ## What Gets Installed
22
23
 
@@ -38,15 +39,36 @@ Both are installed only if not already present. Existing installations are prese
38
39
  | Bash history | `.persistent-home/` | Yes |
39
40
  | Per-terminal sessions | `.claude-sessions/` | Yes |
40
41
 
42
+ ## Automatic Token Refresh
43
+
44
+ Claude OAuth tokens expire every **8-12 hours**. DATA Tools automatically refreshes them:
45
+
46
+ - **On every shell start**: Checks token expiry and refreshes if < 2 hours remaining
47
+ - **When expired**: Attempts automatic refresh using the stored refresh token
48
+ - **Transparent**: You'll see `🔄 Token expires in 1h, refreshing...` then `✅ Token refreshed (11h remaining)`
49
+
50
+ This means you can leave overnight and come back to a working session - no more `claude login` every morning.
51
+
52
+ ### Manual Token Commands
53
+
54
+ ```bash
55
+ # Check token status
56
+ /home/runner/workspace/scripts/claude-auth-refresh.sh --status
57
+
58
+ # Force refresh now
59
+ /home/runner/workspace/scripts/claude-auth-refresh.sh --force
60
+
61
+ # Or use a permanent API token (never expires)
62
+ claude setup-token
63
+ ```
64
+
41
65
  ## The Session Picker
42
66
 
43
67
  After installation (and on every new shell), you'll see:
44
68
 
45
69
  ```
46
- ✅ Claude Code already installed (1.0.17)
47
- Codex CLI already installed
48
-
49
- ✅ Claude authentication: valid (23h remaining)
70
+ ✅ Claude authentication: valid (11h remaining)
71
+ Claude Code ready: 2.0.71 (Claude Code)
50
72
 
51
73
  ╭─────────────────────────────────────────────────────────╮
52
74
  │ Claude Session Manager │
@@ -101,10 +123,10 @@ Press `c` to continue YOUR terminal's last session. Other terminals are unaffect
101
123
  The installer creates symlinks from ephemeral locations to persistent workspace storage:
102
124
 
103
125
  ```
104
- ~/.claude → /workspace/.claude-persistent/
105
- ~/.codex → /workspace/.codex-persistent/
126
+ ~/.claude → /workspace/.claude-persistent/
127
+ ~/.codex → /workspace/.codex-persistent/
106
128
  ~/.local/share/claude → /workspace/.local/share/claude/
107
- ~/.local/bin/claude → /workspace/.local/share/claude/versions/X.X.X
129
+ ~/.local/bin/claude → /workspace/.local/share/claude/versions/X.X.X
108
130
  ```
109
131
 
110
132
  Three layers ensure setup runs on every restart:
@@ -117,23 +139,34 @@ Three layers ensure setup runs on every restart:
117
139
  The installer checks for:
118
140
 
119
141
  - **`CLAUDE_CONFIG_DIR`** - Respects custom Claude config directory if set in Replit Secrets
120
- - **Existing persistent config** - Uses your existing `.claude-persistent/` if present
142
+ - **`CODEX_HOME`** - Respects custom Codex config directory
143
+ - **Existing persistent config** - Uses your existing config if present
121
144
  - **Replit Secrets** - Detects `ANTHROPIC_API_KEY` and `OPENAI_API_KEY`
122
145
  - **Existing installations** - Won't reinstall Claude or Codex if already present
123
146
  - **Existing data in ~/.claude** - Moves it to persistent storage instead of overwriting
124
147
 
125
148
  ### Supported Environment Variables
126
149
 
150
+ **Claude Code:**
151
+
127
152
  | Variable | Purpose |
128
153
  |----------|---------|
129
- | `CLAUDE_CONFIG_DIR` | Custom directory for Claude config/data (recommended) |
130
- | `CLAUDE_WORKSPACE_DIR` | Alternative name for config directory |
131
- | `CLAUDE_DATA_DIR` | Alternative name for config directory |
132
- | `CLAUDE_HOME` | Alternative name for config directory |
154
+ | `CLAUDE_CONFIG_DIR` | Custom directory for Claude config/data |
155
+ | `CLAUDE_WORKSPACE_DIR` | Alternative name (both are valid) |
156
+ | `CLAUDE_DATA_DIR` | Alternative name |
157
+ | `CLAUDE_HOME` | Alternative name |
133
158
  | `ANTHROPIC_API_KEY` | Claude API authentication |
159
+
160
+ **OpenAI Codex CLI:**
161
+
162
+ | Variable | Purpose |
163
+ |----------|---------|
164
+ | `CODEX_HOME` | Custom directory for Codex config/data (official) |
165
+ | `CODEX_CONFIG_DIR` | Alternative name |
166
+ | `CODEX_DATA_DIR` | Alternative name |
134
167
  | `OPENAI_API_KEY` | Codex API authentication |
135
168
 
136
- If you set `CLAUDE_CONFIG_DIR` in your Replit Secrets to a path inside `/home/runner/workspace/`, DATA Tools will use that directory for persistence instead of the default `.claude-persistent/`.
169
+ If you set these in your Replit Secrets to paths inside `/home/runner/workspace/`, DATA Tools will use those directories for persistence instead of the defaults.
137
170
 
138
171
  ## Installation Options
139
172
 
@@ -177,13 +210,13 @@ export CLAUDE_NO_PROMPT=true
177
210
 
178
211
  Add to `.config/bashrc` to make permanent.
179
212
 
180
- ### Fix authentication permanently
213
+ ### Use a permanent API token
181
214
 
182
215
  ```bash
183
216
  claude setup-token
184
217
  ```
185
218
 
186
- Creates a long-lived API token that doesn't expire (OAuth tokens expire every ~24h).
219
+ Creates a long-lived API token that never expires (recommended for unattended use).
187
220
 
188
221
  ## Files Created
189
222
 
@@ -195,9 +228,11 @@ workspace/
195
228
  ├── .local/share/claude/ # Claude binary versions
196
229
  ├── .persistent-home/ # Bash history
197
230
  ├── .config/bashrc # Shell startup config
231
+ ├── logs/ # Auth refresh logs
198
232
  ├── scripts/
199
- │ ├── setup-claude-code.sh
200
- └── claude-session-manager.sh
233
+ │ ├── setup-claude-code.sh # Main setup script
234
+ ├── claude-session-manager.sh # Interactive session picker
235
+ │ └── claude-auth-refresh.sh # OAuth token auto-refresh
201
236
  └── .gitignore # Updated to ignore credential dirs
202
237
  ```
203
238
 
@@ -215,11 +250,18 @@ source /home/runner/workspace/scripts/setup-claude-code.sh
215
250
  source /home/runner/workspace/.config/bashrc
216
251
  ```
217
252
 
218
- ### Auth expired
253
+ ### Auth keeps expiring
254
+
255
+ The auto-refresh should handle this, but if it fails:
219
256
 
220
257
  ```bash
221
- claude login
222
- # Or for permanent fix:
258
+ # Check why refresh failed
259
+ cat /home/runner/workspace/logs/auth-refresh.log
260
+
261
+ # Manual refresh
262
+ /home/runner/workspace/scripts/claude-auth-refresh.sh --force
263
+
264
+ # Or use permanent token (recommended)
223
265
  claude setup-token
224
266
  ```
225
267