clay-server 2.44.0-beta.1 → 2.44.1-beta.1

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/lib/os-users.js +38 -4
  2. package/package.json +1 -1
package/lib/os-users.js CHANGED
@@ -339,12 +339,44 @@ function getLinuxUserUid(username) {
339
339
  }
340
340
  }
341
341
 
342
+ /**
343
+ * Check whether the Claude CLI is already resolvable for a Linux user,
344
+ * using the same login PATH the session will actually run with.
345
+ * Runs `command -v claude` inside a login shell (`su - <user>`) so a
346
+ * system-wide install (e.g. /usr/bin/claude) is detected, not just the
347
+ * hardcoded ~/.local/bin/claude path.
348
+ * Returns true if claude resolves, false otherwise.
349
+ */
350
+ function claudeAvailableForUser(linuxName) {
351
+ if (!isSafeLinuxUsername(linuxName)) return false;
352
+ try {
353
+ var out = execFileSync("su", ["-", linuxName, "-c", "command -v claude"], {
354
+ encoding: "utf8",
355
+ timeout: 10000,
356
+ stdio: "pipe",
357
+ }).trim();
358
+ return out.length > 0;
359
+ } catch (e) {
360
+ return false;
361
+ }
362
+ }
363
+
342
364
  /**
343
365
  * Install Claude CLI for a Linux user account.
344
366
  * Downloads and runs the install script, then ensures PATH is configured.
345
367
  * Non-fatal: logs errors but does not throw.
368
+ * Skips entirely when claude is already resolvable for the user, or when
369
+ * CLAY_SKIP_CLAUDE_INSTALL is set (bring-your-own-claude).
346
370
  */
347
371
  function installClaudeCli(linuxName) {
372
+ if (process.env.CLAY_SKIP_CLAUDE_INSTALL) {
373
+ console.log("[os-users] CLAY_SKIP_CLAUDE_INSTALL set, skipping Claude CLI install for " + linuxName);
374
+ return;
375
+ }
376
+ if (claudeAvailableForUser(linuxName)) {
377
+ console.log("[os-users] Claude CLI already available for " + linuxName + ", skipping install");
378
+ return;
379
+ }
348
380
  try {
349
381
  if (!isSafeLinuxUsername(linuxName)) throw new Error("Invalid Linux username");
350
382
  // Download and run the Claude CLI install script as the target user
@@ -429,10 +461,11 @@ function provisionAllUsers(usersModule) {
429
461
  if (user.linuxUser) {
430
462
  // Already mapped, verify the Linux user still exists
431
463
  if (linuxUserExists(user.linuxUser)) {
432
- // Ensure Claude CLI is installed for existing users
433
- var cliPath = "/home/" + user.linuxUser + "/.local/bin/claude";
434
- if (!fs.existsSync(cliPath)) {
435
- console.log("[os-users] Claude CLI missing for " + user.linuxUser + ", installing...");
464
+ // Ensure Claude CLI is available for existing users. Resolve against
465
+ // the user's actual login PATH so a system-wide install counts, rather
466
+ // than checking a single hardcoded ~/.local/bin/claude path.
467
+ if (!claudeAvailableForUser(user.linuxUser)) {
468
+ console.log("[os-users] Claude CLI not resolvable for " + user.linuxUser + ", installing...");
436
469
  installClaudeCli(user.linuxUser);
437
470
  }
438
471
  // Ensure linger is enabled for existing users
@@ -520,6 +553,7 @@ module.exports = {
520
553
  provisionAllUsers: provisionAllUsers,
521
554
  grantAllUsersAccess: grantAllUsersAccess,
522
555
  installClaudeCli: installClaudeCli,
556
+ claudeAvailableForUser: claudeAvailableForUser,
523
557
  deactivateLinuxUser: deactivateLinuxUser,
524
558
  ensureProjectsDir: ensureProjectsDir,
525
559
  isHomeDirectory: isHomeDirectory,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clay-server",
3
- "version": "2.44.0-beta.1",
3
+ "version": "2.44.1-beta.1",
4
4
  "description": "Self-hosted team workspace for Claude Code and Codex. Multi-user, browser-based, with persistent AI mates.",
5
5
  "bin": {
6
6
  "clay-server": "./bin/cli.js",