codewhisper-agent 0.1.0 → 0.2.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/cli.js CHANGED
@@ -16,6 +16,7 @@ function printHelp() {
16
16
 
17
17
  Options:
18
18
  --login Pair with your phone using a pairing code
19
+ --token <token> Cloud token for automated auth (or use CODEWHISPER_TOKEN env)
19
20
  --name <name> Agent name (default: project folder name)
20
21
  --agent-id <id> Agent ID (auto-generated if not set)
21
22
  --user-id <id> User ID (set via --login pairing)
@@ -44,6 +45,7 @@ function parseArgs() {
44
45
  case '--backend': opts.backendWsUrl = args[++i]; break;
45
46
  case '--permission': opts.permissionMode = args[++i]; break;
46
47
  case '--allowed-tools': opts.allowedTools = args[++i]; break;
48
+ case '--token': opts.cloudToken = args[++i]; break;
47
49
  case '--login': opts._login = true; break;
48
50
  case '--config': opts._showConfig = true; break;
49
51
  case '--reset': opts._reset = true; break;
@@ -279,8 +281,15 @@ async function loginFlow() {
279
281
  // --- Main ---
280
282
 
281
283
  async function main() {
282
- // Login if explicitly requested or if userId is missing
283
- const needsLogin = _login || !configStore.get('userId');
284
+ // Cloud token: from --token flag or CODEWHISPER_TOKEN env
285
+ const cloudToken = configStore.get('cloudToken') || process.env.CODEWHISPER_TOKEN || '';
286
+ if (cloudToken) {
287
+ configStore.set('cloudToken', cloudToken);
288
+ console.log(' \x1b[36mCloud token detected — skipping pairing\x1b[0m');
289
+ }
290
+
291
+ // Login if explicitly requested or if userId is missing (skip if cloud token)
292
+ const needsLogin = !cloudToken && (_login || !configStore.get('userId'));
284
293
  if (needsLogin) {
285
294
  await loginFlow();
286
295
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codewhisper-agent",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "CLI agent for CodeWhisper - remotely control AI coding CLIs (Claude Code, Gemini CLI and more) from your mobile",
5
5
  "main": "src/agent.js",
6
6
  "bin": {
@@ -34,6 +34,7 @@
34
34
  "bin/",
35
35
  "src/agent.js",
36
36
  "src/config-store.js",
37
- "src/crypto.js"
37
+ "src/crypto.js",
38
+ "templates/"
38
39
  ]
39
40
  }
package/src/agent.js CHANGED
@@ -213,11 +213,18 @@ class Agent {
213
213
  if (this._stopped) return;
214
214
 
215
215
  const params = new URLSearchParams({
216
- user_id: this._config.userId,
217
216
  name: this._config.agentName,
218
217
  project_path: this._config.projectPath,
219
218
  cli_type: this._config.cliType,
220
219
  });
220
+
221
+ // Cloud token auth: pass token instead of user_id
222
+ if (this._config.cloudToken) {
223
+ params.set('token', this._config.cloudToken);
224
+ } else {
225
+ params.set('user_id', this._config.userId);
226
+ }
227
+
221
228
  const url = `${this._config.backendWsUrl}/ws/agent/${this._config.agentId}?${params}`;
222
229
 
223
230
  this._log(`Connecting to backend...`);
@@ -8,7 +8,7 @@ const GLOBAL_FILE = path.join(CONFIG_DIR, 'config.json');
8
8
  const PROJECTS_DIR = path.join(CONFIG_DIR, 'projects');
9
9
 
10
10
  // Global keys — shared across all projects
11
- const GLOBAL_KEYS = ['userId', 'backendWsUrl', 'secretKey', 'publicKey', 'sharedSecret'];
11
+ const GLOBAL_KEYS = ['userId', 'backendWsUrl', 'secretKey', 'publicKey', 'sharedSecret', 'cloudToken'];
12
12
 
13
13
  const DEFAULTS = {
14
14
  agentName: 'my-pc',
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "CodeWhisper Cloud Agent",
3
+ "image": "mcr.microsoft.com/devcontainers/universal:2",
4
+ "features": {
5
+ "ghcr.io/devcontainers/features/node:1": {
6
+ "version": "20"
7
+ }
8
+ },
9
+ "postStartCommand": "npx codewhisper-agent@latest --token $CODEWHISPER_TOKEN --project /workspaces/${localWorkspaceFolderBasename}"
10
+ }