talos-deploy 0.0.3 → 0.0.5

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.
@@ -6,7 +6,7 @@ import { loadConfig, getPortalUrl } from "../config/index.js";
6
6
  export async function api(path, options = {}) {
7
7
  const config = loadConfig();
8
8
  if (!config) {
9
- console.error("Not logged in. Run: tt login");
9
+ console.error("Not logged in. Run: talosd auth login");
10
10
  process.exit(1);
11
11
  }
12
12
  const portalUrl = getPortalUrl();
@@ -21,7 +21,7 @@ export async function api(path, options = {}) {
21
21
  headers,
22
22
  });
23
23
  if (resp.status === 401) {
24
- console.error("Session expired. Run: tt login");
24
+ console.error("Session expired. Run: talosd auth login");
25
25
  process.exit(1);
26
26
  }
27
27
  return resp;
@@ -16,7 +16,7 @@ export async function authLoginCommand() {
16
16
  const data = (await resp.json());
17
17
  if (data.user?.email) {
18
18
  console.log(`Already logged in as ${data.user.email}`);
19
- console.log(`To switch accounts, run: tt auth login --force`);
19
+ console.log(`To switch accounts, run: talosd auth login --force`);
20
20
  return;
21
21
  }
22
22
  }
@@ -70,7 +70,7 @@ export async function authStatusCommand() {
70
70
  const portalUrl = getPortalUrl();
71
71
  if (!config?.token) {
72
72
  console.log("Not logged in.");
73
- console.log("Run: tt auth login");
73
+ console.log("Run: talosd auth login");
74
74
  return;
75
75
  }
76
76
  try {
@@ -83,7 +83,7 @@ export async function authStatusCommand() {
83
83
  console.log(`Server: ${portalUrl}`);
84
84
  }
85
85
  else {
86
- console.log("Session expired. Run: tt auth login");
86
+ console.log("Session expired. Run: talosd auth login");
87
87
  }
88
88
  }
89
89
  catch {
@@ -56,7 +56,7 @@ export async function upCommand(opts) {
56
56
  // Step 4: Write SSH config with ProxyCommand
57
57
  const binaryPath = resolveTalosBinaryPath();
58
58
  updateSshConfig(opts.project, binaryPath);
59
- process.stdout.write(`${CLEAR_LINE} ${GREEN}✓${RESET} SSH config updated (host: tt-${opts.project})\n`);
59
+ process.stdout.write(`${CLEAR_LINE} ${GREEN}✓${RESET} SSH config updated (host: talosd-${opts.project})\n`);
60
60
  // Step 5: SSH via host alias
61
61
  console.log(`\n ${BOLD}Connecting via SSH...${RESET}\n`);
62
62
  await sshIntoSandbox(opts.project);
@@ -4,9 +4,10 @@ import os from "os";
4
4
  import dotenv from "dotenv";
5
5
  export const CONFIG_DIR = path.join(os.homedir(), ".talos");
6
6
  export const CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
7
- // Load .env from current directory or project root
8
- dotenv.config({ path: path.resolve(process.cwd(), ".env") }) ||
9
- dotenv.config({ path: path.resolve(process.cwd(), "../..", ".env") });
7
+ // Load .env from current directory or project root (quiet: suppresses banner
8
+ // that would corrupt SSH ProxyCommand binary protocol on stdout)
9
+ dotenv.config({ path: path.resolve(process.cwd(), ".env"), quiet: true }) ||
10
+ dotenv.config({ path: path.resolve(process.cwd(), "../..", ".env"), quiet: true });
10
11
  // ── Config loading ─────────────────────────────────────
11
12
  export function loadConfig() {
12
13
  if (!fs.existsSync(CONFIG_FILE))
package/dist/index.js CHANGED
@@ -1,13 +1,18 @@
1
1
  #!/usr/bin/env node
2
+ import { readFileSync } from "fs";
3
+ import { dirname, join } from "path";
4
+ import { fileURLToPath } from "url";
2
5
  import { Command } from "commander";
3
6
  import { authLoginCommand, authStatusCommand, authLogoutCommand } from "./commands/auth.js";
4
7
  import { upCommand } from "./commands/up.js";
5
8
  import { sshProxyCommand } from "./commands/ssh-proxy.js";
9
+ const __dirname = dirname(fileURLToPath(import.meta.url));
10
+ const { version } = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"));
6
11
  const program = new Command();
7
12
  program
8
13
  .name("talosd")
9
14
  .description("Talos Deploy CLI — sandbox environments for Claude Code")
10
- .version("0.1.0");
15
+ .version(version);
11
16
  // ── auth ──────────────────────────────────────────────────
12
17
  const authCmd = program
13
18
  .command("auth")
package/dist/lib/ssh.js CHANGED
@@ -150,14 +150,15 @@ export function updateSshConfig(project, binaryPath, sshConfigPath = path.join(o
150
150
  if (fs.existsSync(sshConfigPath)) {
151
151
  content = fs.readFileSync(sshConfigPath, "utf-8");
152
152
  }
153
- const hostAlias = `tt-${project}`;
153
+ const hostAlias = `talosd-${project}`;
154
154
  const block = `\nHost ${hostAlias}\n` +
155
155
  ` User coder\n` +
156
156
  ` StrictHostKeyChecking no\n` +
157
157
  ` UserKnownHostsFile /dev/null\n` +
158
158
  ` IdentityFile ~/.ssh/id_ed25519\n` +
159
159
  ` ProxyCommand ${binaryPath} ssh-proxy --project ${project}\n`;
160
- const regex = new RegExp(`\n?Host ${hostAlias}\n(?: .*\n)*`);
160
+ // Replace existing block (new talosd- or legacy tt- naming)
161
+ const regex = new RegExp(`\n?Host (?:talosd|tt)-${project}\n(?: .*\n)*`);
161
162
  if (regex.test(content)) {
162
163
  content = content.replace(regex, block);
163
164
  }
@@ -169,9 +170,11 @@ export function updateSshConfig(project, binaryPath, sshConfigPath = path.join(o
169
170
  // ── SSH session ────────────────────────────────────────
170
171
  export function sshIntoSandbox(project, spawnFn = spawn) {
171
172
  return new Promise((resolve, reject) => {
172
- const ssh = spawnFn("ssh", [`tt-${project}`], { stdio: "inherit" });
173
+ const ssh = spawnFn("ssh", [`talosd-${project}`], { stdio: "inherit" });
173
174
  ssh.on("close", (code) => {
174
- if (code && code !== 0) {
175
+ // code 0 = normal exit, code 130 = Ctrl+C (SIGINT), null = signal death
176
+ // All are expected ways to end an interactive SSH session
177
+ if (code && code !== 0 && code !== 130) {
175
178
  reject(new Error(`SSH exited with code ${code}`));
176
179
  }
177
180
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "talos-deploy",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Talos Deploy CLI — sandbox environments for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {