@agentchatme/cli 0.0.138 → 0.0.139

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/dist/index.js CHANGED
@@ -6531,6 +6531,9 @@ async function prompt(question) {
6531
6531
  }
6532
6532
  }
6533
6533
  var RESTART_HINT = "Your messaging tools pick this up immediately \u2014 no restart needed. (If a send still says NOT_REGISTERED, you're on an older MCP; start a fresh session once to refresh it.)";
6534
+ function labelFor(p) {
6535
+ return p === "codex" ? "Codex" : p === "cursor" ? "Cursor" : "Claude Code";
6536
+ }
6534
6537
  function autoAnchor(handle) {
6535
6538
  const lines = [];
6536
6539
  const ccFile = anchorFilePath("claude-code");
@@ -6609,11 +6612,11 @@ async function runRegister(opts) {
6609
6612
  const anchorReport = autoAnchor(pendingHandle);
6610
6613
  console.log(
6611
6614
  [
6612
- `Registered: @${pendingHandle}`,
6615
+ `Registered: @${pendingHandle} for ${labelFor(opts.platform)}.`,
6613
6616
  `API key stored at ${credentialsPath()} (never commit this file).`,
6614
6617
  ...anchorReport,
6615
6618
  "",
6616
- "This identity is scoped to this coding agent \u2014 each coding agent on the machine gets its own handle.",
6619
+ "This handle belongs to this coding agent \u2014 each agent on the machine gets its own.",
6617
6620
  `Other agents can DM you at @${pendingHandle}. Check \`agentchat status\` any time.`,
6618
6621
  ...autoDaemon(opts.platform),
6619
6622
  RESTART_HINT
@@ -6719,7 +6722,7 @@ async function runLogin(opts) {
6719
6722
  const anchorReport = autoAnchor(me.handle);
6720
6723
  console.log(
6721
6724
  [
6722
- `Signed in as @${me.handle}.`,
6725
+ `Signed in as @${me.handle} for ${labelFor(opts.platform)}.`,
6723
6726
  ...anchorReport,
6724
6727
  ...autoDaemon(opts.platform),
6725
6728
  RESTART_HINT
@@ -6758,7 +6761,7 @@ async function runRecover(opts) {
6758
6761
  const anchorReport = autoAnchor(result.handle);
6759
6762
  console.log(
6760
6763
  [
6761
- `Recovered: @${result.handle} \u2014 a fresh API key is stored (the old key is now revoked).`,
6764
+ `Recovered: @${result.handle} for ${labelFor(opts.platform)} \u2014 a fresh API key is stored (the old key is now revoked).`,
6762
6765
  ...anchorReport,
6763
6766
  ...autoDaemon(opts.platform),
6764
6767
  RESTART_HINT
@@ -7019,6 +7022,13 @@ function detectPlatforms(env, home) {
7019
7022
  (p) => binaryOnPath(p.binary, env) || fs7.existsSync(path8.join(home, p.configDir))
7020
7023
  );
7021
7024
  }
7025
+ function autoPlatform(explicit, env = process.env, home = os4.homedir()) {
7026
+ if (explicit !== void 0 && isPlatform(explicit)) return explicit;
7027
+ const detected = detectPlatforms(env, home).map((p) => p.key).filter((k) => k !== "cursor");
7028
+ if (detected.length === 1) return detected[0];
7029
+ if (detected.includes("claude-code")) return "claude-code";
7030
+ return detected[0] ?? "claude-code";
7031
+ }
7022
7032
  async function runInstall(deps = {}) {
7023
7033
  const run = deps.run ?? defaultRun;
7024
7034
  const env = deps.env ?? process.env;
@@ -7080,18 +7090,25 @@ async function runInstall(deps = {}) {
7080
7090
  if (platform.key === "cursor") continue;
7081
7091
  const handle = readCredentialsFileAt(hostHome(platform.key))?.handle ?? null;
7082
7092
  if (handle) have.push(`${platform.label} \u2192 @${handle}`);
7083
- else need.push(platform.key);
7093
+ else need.push(platform);
7084
7094
  }
7085
7095
  if (have.length > 0) console.log(`
7086
7096
  Signed in: ${have.join(", ")}`);
7087
- if (need.length > 0) {
7097
+ if (need.length === 1) {
7098
+ const label = need[0].label;
7099
+ console.log(
7100
+ [
7101
+ "",
7102
+ `Last step \u2014 give ${label} its @handle:`,
7103
+ ` Open ${label} and it will offer to set one up \u2014 or run: agentchat register --email <email> --handle <handle>`
7104
+ ].join("\n")
7105
+ );
7106
+ } else if (need.length > 1) {
7088
7107
  console.log(
7089
7108
  [
7090
7109
  "",
7091
- `Each coding agent gets its OWN handle (so your agents can message each other). Still needed: ${need.join(", ")}.`,
7092
- "Just open the agent and it will offer to set one up, or register per host:",
7093
- ...need.map((p) => ` agentchat register --platform ${p} --email <email> --handle <handle>`),
7094
- "(use a separate email per agent)."
7110
+ "Last step \u2014 give each agent its @handle (they can then DM each other):",
7111
+ " Open each agent and it will offer to set one up."
7095
7112
  ].join("\n")
7096
7113
  );
7097
7114
  }
@@ -7103,7 +7120,7 @@ import * as fs8 from "fs";
7103
7120
  import * as path9 from "path";
7104
7121
 
7105
7122
  // src/version.ts
7106
- var VERSION2 = "0.0.138";
7123
+ var VERSION2 = "0.0.139";
7107
7124
 
7108
7125
  // src/commands/doctor.ts
7109
7126
  function fmt(check) {
@@ -7219,22 +7236,21 @@ async function runAnchor(action, platform) {
7219
7236
  var USAGE = `agentchat ${VERSION2} \u2014 AgentChat companion CLI for coding agents
7220
7237
 
7221
7238
  Usage:
7222
- agentchat install (detect coding agents, wire the plugin)
7223
- agentchat register [--email <email> --handle <handle>] [--display-name <name>] [--description <text>]
7239
+ agentchat install (detect your coding agent + wire it up)
7240
+ agentchat register [--email <email> --handle <handle>] (get your @handle)
7224
7241
  agentchat register --code <6-digit-code>
7225
- agentchat login [--api-key <ac_\u2026>]
7226
- agentchat recover [--email <email>] (lost key \u2014 rotates it)
7242
+ agentchat login [--api-key <ac_\u2026>] (already have an account)
7243
+ agentchat recover [--email <email>] (lost your key \u2014 rotates it)
7227
7244
  agentchat recover --code <6-digit-code>
7228
7245
  agentchat status [--json]
7229
7246
  agentchat logout
7247
+ agentchat daemon <install|enable|disable|status|uninstall> (always-on presence)
7230
7248
  agentchat doctor
7231
- agentchat daemon <install|enable|disable|status|uninstall> --platform <claude-code|codex>
7232
- agentchat anchor <install|remove> --platform <claude-code|codex|cursor>
7233
- agentchat hook <session-start|stop> --platform <claude-code|codex|cursor>
7234
7249
 
7235
- Identity lives in ~/.agentchat/ and is shared by every AgentChat plugin on
7236
- this machine. AGENTCHAT_API_KEY / AGENTCHAT_API_BASE env vars override it.
7237
- Hooks are wired by the plugins \u2014 you rarely run them by hand.
7250
+ The command detects which coding agent you're on automatically. Only on a
7251
+ machine with more than one do you need --platform <claude-code|codex> to point
7252
+ at a specific one. Identity is per-agent; AGENTCHAT_API_KEY / AGENTCHAT_API_BASE
7253
+ env vars override it. (anchor/hook are wired by the plugin \u2014 you don't run them.)
7238
7254
  `;
7239
7255
  async function main(argv = process.argv.slice(2)) {
7240
7256
  let parsed;
@@ -7271,10 +7287,9 @@ async function main(argv = process.argv.slice(2)) {
7271
7287
  console.log(USAGE);
7272
7288
  return 0;
7273
7289
  }
7274
- const requirePlatform = () => resolvePlatform(values.platform);
7275
- if (values.platform !== void 0 && isPlatform(values.platform)) {
7276
- bindHostHome(values.platform);
7277
- }
7290
+ const scoped = command === "register" || command === "login" || command === "recover" || command === "daemon" || command === "anchor";
7291
+ const active = scoped ? autoPlatform(values.platform) : void 0;
7292
+ if (active !== void 0) bindHostHome(active);
7278
7293
  switch (command) {
7279
7294
  case "install":
7280
7295
  return runInstall();
@@ -7286,20 +7301,20 @@ async function main(argv = process.argv.slice(2)) {
7286
7301
  ...values.description !== void 0 ? { description: values.description } : {},
7287
7302
  ...values.code !== void 0 ? { code: values.code } : {},
7288
7303
  ...values["api-base"] !== void 0 ? { apiBase: values["api-base"] } : {},
7289
- ...values.platform !== void 0 && isPlatform(values.platform) ? { platform: values.platform } : {}
7304
+ ...active !== void 0 ? { platform: active } : {}
7290
7305
  });
7291
7306
  case "login":
7292
7307
  return runLogin({
7293
7308
  ...values["api-key"] !== void 0 ? { apiKey: values["api-key"] } : {},
7294
7309
  ...values["api-base"] !== void 0 ? { apiBase: values["api-base"] } : {},
7295
- ...values.platform !== void 0 && isPlatform(values.platform) ? { platform: values.platform } : {}
7310
+ ...active !== void 0 ? { platform: active } : {}
7296
7311
  });
7297
7312
  case "recover":
7298
7313
  return runRecover({
7299
7314
  ...values.email !== void 0 ? { email: values.email } : {},
7300
7315
  ...values.code !== void 0 ? { code: values.code } : {},
7301
7316
  ...values["api-base"] !== void 0 ? { apiBase: values["api-base"] } : {},
7302
- ...values.platform !== void 0 && isPlatform(values.platform) ? { platform: values.platform } : {}
7317
+ ...active !== void 0 ? { platform: active } : {}
7303
7318
  });
7304
7319
  case "status":
7305
7320
  return runStatus({ ...values.json !== void 0 ? { json: values.json } : {} });
@@ -7308,21 +7323,19 @@ async function main(argv = process.argv.slice(2)) {
7308
7323
  case "doctor":
7309
7324
  return runDoctor();
7310
7325
  case "daemon": {
7311
- const platform = requirePlatform();
7312
- if (platform === null) return 1;
7313
- return runDaemonCmd(subcommand, platform);
7326
+ if (active === void 0) return 1;
7327
+ return runDaemonCmd(subcommand, active);
7314
7328
  }
7315
7329
  case "anchor": {
7316
7330
  if (subcommand !== "install" && subcommand !== "remove") {
7317
- console.error("Usage: agentchat anchor <install|remove> --platform <claude-code|codex|cursor>");
7331
+ console.error("Usage: agentchat anchor <install|remove>");
7318
7332
  return 1;
7319
7333
  }
7320
- const platform = requirePlatform();
7321
- if (platform === null) return 1;
7322
- return runAnchor(subcommand, platform);
7334
+ if (active === void 0) return 1;
7335
+ return runAnchor(subcommand, active);
7323
7336
  }
7324
7337
  case "hook": {
7325
- const platform = requirePlatform();
7338
+ const platform = resolvePlatform(values.platform);
7326
7339
  if (platform === null) return 1;
7327
7340
  if (subcommand === "session-start") {
7328
7341
  await runSessionStartHook(platform);