@commonlyai/cli 0.1.329 → 0.1.330

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commonlyai/cli",
3
- "version": "0.1.329",
3
+ "version": "0.1.330",
4
4
  "license": "Apache-2.0",
5
5
  "description": "The Commonly CLI — connect agents, manage pods, iterate fast",
6
6
  "type": "module",
@@ -164,6 +164,7 @@ import {
164
164
  } from '../lib/enforcement.js';
165
165
  import { buildReplyReceipt } from '../lib/reply-receipt.js';
166
166
  import { savedRuntimeControls, withSavedRuntimeControls, effortRefusedByDevice } from '../lib/seat-runtime-controls.js';
167
+ import { CLI } from '../lib/cli-hint.js';
167
168
 
168
169
  const isPodFocusDiagnostic = (error) => (
169
170
  typeof error?.code === 'string'
@@ -190,7 +191,7 @@ export const saveAgentToken = (name, record) => {
190
191
  try {
191
192
  refreshMcpTokenCopy(name, record?.runtimeToken);
192
193
  } catch (err) {
193
- console.warn(`Could not refresh the MCP token copy for '${name}': ${err.message}. Run: commonly mcp config --agent ${name}`);
194
+ console.warn(`Could not refresh the MCP token copy for '${name}': ${err.message}. Run: ${CLI} mcp config --agent ${name}`);
194
195
  }
195
196
  };
196
197
 
@@ -216,7 +217,7 @@ export const seatKey = (agentName, instanceId) => (
216
217
  );
217
218
 
218
219
  const runCommandFor = (agentName, instanceId) => (
219
- `commonly agent run ${agentName}${isDefaultInstanceId(instanceId) ? '' : ` --instance-id ${instanceId}`}`
220
+ `${CLI} agent run ${agentName}${isDefaultInstanceId(instanceId) ? '' : ` --instance-id ${instanceId}`}`
220
221
  );
221
222
 
222
223
  /**
@@ -402,7 +403,7 @@ export const serverAdapterBindingRefusal = ({
402
403
  if (runtimeAdapterForInstallation({ installations, podId, instanceId }) === adapter) return null;
403
404
  const refusal = `Adapter '${adapter}' is not declared for this Commonly installation.`;
404
405
  if (!includeAttachGuidance) return refusal;
405
- return `${refusal} A pod owner must sign in with commonly login, then run commonly agent attach ${adapter}`
406
+ return `${refusal} A pod owner must sign in with ${CLI} login, then run ${CLI} agent attach ${adapter}`
406
407
  + ` --pod ${podId || '<pod-id>'} --name ${agentName || '<agent-name>'}`
407
408
  + ` [--env <environment.yaml>] before this seat can use adapter '${adapter}'.`;
408
409
  };
@@ -449,7 +450,7 @@ export const printAttachRunGuidance = ({
449
450
  warn = console.warn,
450
451
  } = {}) => {
451
452
  if (binding?.canRun) {
452
- log(`\n Run with: commonly agent run ${agentName}`);
453
+ log(`\n Run with: ${CLI} agent run ${agentName}`);
453
454
  } else {
454
455
  warn(`\n WARNING: ${binding?.warning || 'The server did not confirm this adapter binding.'}`);
455
456
  }
@@ -490,7 +491,7 @@ export const checkRunAllowRequest = ({ record, requested = [] }) => {
490
491
  message: [
491
492
  `'${name}' was set up with ${saved.length ? `--allow ${saved.join(',')}` : 'no --allow'}; `
492
493
  + `--allow ${requested.join(',')} was not applied.`,
493
- `To change it: commonly agent detach ${name} --force, then re-run with the Connect-page `
494
+ `To change it: ${CLI} agent detach ${name} --force, then re-run with the Connect-page `
494
495
  + `env exports and --allow ${requested.join(',')}.`,
495
496
  ].join('\n'),
496
497
  };
@@ -522,8 +523,8 @@ export const checkRunAdapterRequest = ({ record, requestedAdapter, tokenPath })
522
523
  ok: false,
523
524
  message: [
524
525
  `'${name}' is bound to the ${bound} adapter by its token file (${tokenPath}); --adapter ${requested} was not applied.`,
525
- `To run it with ${requested} here: commonly agent detach ${name} --force, then re-run with the Connect-page env exports and --adapter ${requested}.`,
526
- `A daemon-managed seat switches with: commonly agent config ${name} --adapter ${requested}`,
526
+ `To run it with ${requested} here: ${CLI} agent detach ${name} --force, then re-run with the Connect-page env exports and --adapter ${requested}.`,
527
+ `A daemon-managed seat switches with: ${CLI} agent config ${name} --adapter ${requested}`,
527
528
  ].join('\n'),
528
529
  };
529
530
  };
@@ -683,7 +684,7 @@ const listAgents = async (opts, deps) => {
683
684
  if (opts.local) {
684
685
  const agents = listLocalAgents();
685
686
  if (agents.length === 0) {
686
- log('No agents attached locally. Run: commonly agent attach <adapter> --pod <podId> --name <n>');
687
+ log(`No agents attached locally. Run: ${CLI} agent attach <adapter> --pod <podId> --name <n>`);
687
688
  return 0;
688
689
  }
689
690
  log(`${col('NAME', 20)} ${col('ADAPTER', 10)} ${col('POD', 26)} LAST TURN`);
@@ -696,7 +697,7 @@ const listAgents = async (opts, deps) => {
696
697
  }
697
698
 
698
699
  const token = tokenFor(opts.instance);
699
- if (!token) { error('Not logged in. Run: commonly login'); return 1; }
700
+ if (!token) { error(`Not logged in. Run: ${CLI} login`); return 1; }
700
701
 
701
702
  const client = clientFactory({ instance: instanceUrlFor(opts.instance), token });
702
703
 
@@ -778,7 +779,7 @@ export const resolveLogsSeat = async (client, podId, typed, instanceId) => {
778
779
  if (hits.length > 1) {
779
780
  const pairs = hits.map((h) => `${h.name || h.agentName}/${h.instanceId}`).join(', ');
780
781
  throw new Error(`${hits.length} seats are named '${typed}' here: ${pairs}. `
781
- + `Run: commonly agent logs <agentName> --pod ${podId} --instance-id <instance>`);
782
+ + `Run: ${CLI} agent logs <agentName> --pod ${podId} --instance-id <instance>`);
782
783
  }
783
784
  if (hits.length === 0) {
784
785
  // A typo must not read like an idle seat, so say what was read instead.
@@ -1256,7 +1257,7 @@ export const updateAgentConfiguration = async ({
1256
1257
  throw new Error('token record is missing agentName — re-attach the agent');
1257
1258
  }
1258
1259
  if (runtimeKey) {
1259
- if (adapter || envPath) throw new Error('--adapter and --env require an owner login; run commonly login');
1260
+ if (adapter || envPath) throw new Error(`--adapter and --env require an owner login; run ${CLI} login`);
1260
1261
  const controls = Object.fromEntries(Object.entries({ model, effort })
1261
1262
  .filter(([, value]) => value !== null && value !== undefined));
1262
1263
  if (!Object.keys(controls).length) throw new Error('provide --model or --effort');
@@ -1528,13 +1529,13 @@ export const performAttach = async ({
1528
1529
  'Instead:',
1529
1530
  ' - Run it without an OS sandbox, which is your choice: use the commands on the Connect page.'
1530
1531
  + ' They set COMMONLY_API_URL and COMMONLY_AGENT_TOKEN, then run'
1531
- + ` commonly agent run <name> --adapter claude ${UNSANDBOXED_FLAG}.`
1532
+ + ` ${CLI} agent run <name> --adapter claude ${UNSANDBOXED_FLAG}.`
1532
1533
  + " It keeps Commonly's restricted tool settings and gets no shell, but nothing at the OS level"
1533
1534
  + ' confines it, and it gets no connector grants.'
1534
1535
  // agent run prefers a saved record over the page's env vars, so an
1535
1536
  // older record of that name would run with its own settings (#3407).
1536
1537
  + ' If this computer already has an agent saved under that name, the run uses that one and its'
1537
- + ' settings instead: remove it first with commonly agent detach <name> --force.',
1538
+ + ` settings instead: remove it first with ${CLI} agent detach <name> --force.`,
1538
1539
  ' - Use Commonly from your own Claude Code sessions: the Connect page shows a PowerShell `claude mcp add` command.',
1539
1540
  ' - A hosted agent: choose "Run it here" on the Connect page. Nothing runs on this machine.',
1540
1541
  ].join('\n') : windowsSandboxMessage(adapterName)));
@@ -2360,7 +2361,7 @@ export const performRun = ({
2360
2361
  const flag = (name, value) => (value && /^[A-Za-z0-9._:/-]+$/.test(value) ? ` --${name} ${value}` : '');
2361
2362
  const flags = `${flag('model', lastSavedControls.model)}${flag('effort', lastSavedControls.effort)}` || ' --model <model>';
2362
2363
  log(`${agentName} has no saved environment on this computer, so the model and effort saved in Commonly `
2363
- + `don't apply to it yet. Run once: commonly agent config ${agentName}${flags}`);
2364
+ + `don't apply to it yet. Run once: ${CLI} agent config ${agentName}${flags}`);
2364
2365
  }
2365
2366
  }
2366
2367
  // Dropped only when the device listed its levels and this one is not
@@ -4807,7 +4808,7 @@ export const performRun = ({
4807
4808
  onError?.(new Error(
4808
4809
  `Runtime token rejected ${consecutiveAuthErrors} times in a row — stopping. `
4809
4810
  + `If this agent's key was reissued, run it again with the new key in COMMONLY_AGENT_TOKEN. `
4810
- + `To remove the agent from its pod: commonly agent detach ${agentName}`,
4811
+ + `To remove the agent from its pod: ${CLI} agent detach ${agentName}`,
4811
4812
  ));
4812
4813
  running = false;
4813
4814
  return;
@@ -5105,17 +5106,17 @@ export const registerAgent = (program) => {
5105
5106
  agent.addHelpText('after', `
5106
5107
  Examples:
5107
5108
  # Wrap your local claude binary as a pod agent (ADR-005)
5108
- $ commonly agent attach claude --pod <podId> --name my-claude
5109
- $ commonly agent run my-claude
5110
- $ commonly agent detach my-claude
5109
+ $ ${CLI} agent attach claude --pod <podId> --name my-claude
5110
+ $ ${CLI} agent run my-claude
5111
+ $ ${CLI} agent detach my-claude
5111
5112
 
5112
5113
  # Scaffold a custom Python agent (ADR-006)
5113
- $ commonly agent init --language python --name research-bot --pod <podId>
5114
+ $ ${CLI} agent init --language python --name research-bot --pod <podId>
5114
5115
 
5115
5116
  # List installed agents
5116
- $ commonly agent list
5117
- $ commonly agent config my-claude --adapter claude --model gpt-5.4 --effort high
5118
- $ commonly agent config my-claude --model gpt-5.4 --effort high
5117
+ $ ${CLI} agent list
5118
+ $ ${CLI} agent config my-claude --adapter claude --model gpt-5.4 --effort high
5119
+ $ ${CLI} agent config my-claude --model gpt-5.4 --effort high
5119
5120
 
5120
5121
  Docs:
5121
5122
  https://github.com/Team-Commonly/commonly/blob/main/docs/agents/LOCAL_CLI_WRAPPER.md
@@ -5135,7 +5136,7 @@ Docs:
5135
5136
  .action(async (opts) => {
5136
5137
  const instanceUrl = resolveInstanceUrl(opts.instance);
5137
5138
  const token = getToken(opts.instance);
5138
- if (!token) { console.error('Not logged in. Run: commonly login'); process.exit(1); }
5139
+ if (!token) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
5139
5140
 
5140
5141
  const client = createClient({ instance: instanceUrl, token });
5141
5142
 
@@ -5190,7 +5191,7 @@ Docs:
5190
5191
  }
5191
5192
  if (runtimeToken) {
5192
5193
  console.log(`\nRuntime token: ${runtimeToken}`);
5193
- console.log('Use this with: commonly agent connect --name <name> --token <token>');
5194
+ console.log(`Use this with: ${CLI} agent connect --name <name> --token <token>`);
5194
5195
  }
5195
5196
  } catch (err) {
5196
5197
  console.error(`Registration failed: ${err.message}`);
@@ -5213,7 +5214,7 @@ Docs:
5213
5214
  .action(async (opts) => {
5214
5215
  const instanceUrl = resolveInstanceUrl(opts.instance);
5215
5216
  const token = opts.token || getToken(opts.instance);
5216
- if (!token) { console.error('Not logged in. Run: commonly login'); process.exit(1); }
5217
+ if (!token) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
5217
5218
 
5218
5219
  const port = parseInt(opts.port, 10);
5219
5220
  const localUrl = `http://localhost:${port}${opts.path}`;
@@ -5280,12 +5281,12 @@ Docs:
5280
5281
  .option('--env <path>', 'Path to environment.json (ADR-008 — sandbox/skills/MCP)')
5281
5282
  .option('--import-memory [path]', 'Import local memory (CLAUDE.md / MEMORY.md / ~/.claude project memory, or a given file/dir) into the agent after attach')
5282
5283
  .option('--yes', 'Skip the import confirmation prompt')
5283
- .option('--wake-on-message', 'Wake this agent on every message in the pod, not only @mentions (ADR-018 ambient wake; default off). Change later with: commonly agent wake <name> on|off')
5284
+ .option('--wake-on-message', `Wake this agent on every message in the pod, not only @mentions (ADR-018 ambient wake; default off). Change later with: ${CLI} agent wake <name> on|off`)
5284
5285
  .option('--instance <url>', 'Target Commonly instance')
5285
5286
  .action(async (adapterName, opts) => {
5286
5287
  const instanceUrl = resolveInstanceUrl(opts.instance);
5287
5288
  const token = getToken(opts.instance);
5288
- if (!token) { console.error('Not logged in. Run: commonly login'); process.exit(1); }
5289
+ if (!token) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
5289
5290
 
5290
5291
  const client = createClient({ instance: instanceUrl, token });
5291
5292
 
@@ -5344,7 +5345,7 @@ Docs:
5344
5345
  });
5345
5346
  } catch (err) {
5346
5347
  console.warn(`Memory import failed (agent is still attached): ${err.message}`);
5347
- console.warn(`Retry with: commonly agent import-memory ${opts.name}`);
5348
+ console.warn(`Retry with: ${CLI} agent import-memory ${opts.name}`);
5348
5349
  }
5349
5350
  }
5350
5351
 
@@ -5376,7 +5377,7 @@ Docs:
5376
5377
  .action(async (name, opts) => {
5377
5378
  const record = loadAgentToken(name);
5378
5379
  if (!record) {
5379
- console.error(`No token for '${name}'. Attach it first: commonly agent attach <adapter> --pod <podId> --name ${name}`);
5380
+ console.error(`No token for '${name}'. Attach it first: ${CLI} agent attach <adapter> --pod <podId> --name ${name}`);
5380
5381
  process.exit(1);
5381
5382
  }
5382
5383
  try {
@@ -5403,13 +5404,13 @@ Docs:
5403
5404
  .action(async (name, opts) => {
5404
5405
  const record = loadAgentToken(name);
5405
5406
  if (!record) {
5406
- console.error(`No token for '${name}'. Attach it first: commonly agent attach <adapter> --pod <podId> --name ${name}`);
5407
+ console.error(`No token for '${name}'. Attach it first: ${CLI} agent attach <adapter> --pod <podId> --name ${name}`);
5407
5408
  process.exit(1);
5408
5409
  }
5409
5410
  // Skill registration is a USER action (pod-membership-checked route),
5410
5411
  // unlike memory import which authenticates as the agent.
5411
5412
  const userToken = getToken(opts.instance);
5412
- if (!userToken) { console.error('Not logged in. Run: commonly login'); process.exit(1); }
5413
+ if (!userToken) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
5413
5414
 
5414
5415
  try {
5415
5416
  const skills = detectSkills({ explicitDir: opts.dir ? pathResolve(opts.dir) : null });
@@ -5538,7 +5539,7 @@ Docs:
5538
5539
  console.error(
5539
5540
  `No token for '${name}'. Either export COMMONLY_API_URL + COMMONLY_AGENT_TOKEN`
5540
5541
  + ` (shown on the Connect your own agent page) and re-run, or:`
5541
- + ` commonly agent attach <adapter> --pod <podId> --name ${agentArg}`,
5542
+ + ` ${CLI} agent attach <adapter> --pod <podId> --name ${agentArg}`,
5542
5543
  );
5543
5544
  process.exit(1);
5544
5545
  }
@@ -5626,7 +5627,7 @@ Docs:
5626
5627
  } else if (savedSeatLacksDefaultSandbox(record)) {
5627
5628
  console.warn(
5628
5629
  `${stamp()} [${name}] this agent's saved settings declare no sandbox, so it runs without one. `
5629
- + `To give it the default: commonly agent detach ${name} --force, then either run a fresh command `
5630
+ + `To give it the default: ${CLI} agent detach ${name} --force, then either run a fresh command `
5630
5631
  + 'from the Connect page, or attach it again with an environment file that sets sandbox.trust: public.',
5631
5632
  );
5632
5633
  }
@@ -5792,8 +5793,8 @@ Docs:
5792
5793
  if (!userToken) {
5793
5794
  console.error(
5794
5795
  `No user login found for ${record.instanceUrl}. Either run `
5795
- + `'commonly login --instance ${record.instanceUrl}' first, or `
5796
- + `'commonly agent detach ${name} --force' to clean up local files only.`,
5796
+ + `'${CLI} login --instance ${record.instanceUrl}' first, or `
5797
+ + `'${CLI} agent detach ${name} --force' to clean up local files only.`,
5797
5798
  );
5798
5799
  process.exit(1);
5799
5800
  }
@@ -5837,7 +5838,7 @@ Docs:
5837
5838
  .action(async (opts) => {
5838
5839
  const instanceUrl = resolveInstanceUrl(opts.instance);
5839
5840
  const token = getToken(opts.instance);
5840
- if (!token) { console.error('Not logged in. Run: commonly login'); process.exit(1); }
5841
+ if (!token) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
5841
5842
 
5842
5843
  const client = createClient({ instance: instanceUrl, token });
5843
5844
 
@@ -5942,7 +5943,7 @@ Use --local to find the name you'd pass to 'agent run' or 'agent detach'.
5942
5943
  }
5943
5944
 
5944
5945
  const token = getToken(opts.instance);
5945
- if (!token) { console.error('Not logged in. Run: commonly login'); process.exit(1); }
5946
+ if (!token) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
5946
5947
  const client = createClient({ instance: resolveInstanceUrl(opts.instance), token });
5947
5948
  const printActivity = async () => {
5948
5949
  const seat = await resolveLogsSeat(client, opts.pod, name, opts.instanceId);
@@ -5982,19 +5983,19 @@ Use --local to find the name you'd pass to 'agent run' or 'agent detach'.
5982
5983
  .action(async (name, opts) => {
5983
5984
  const record = loadAgentToken(name);
5984
5985
  if (!record) {
5985
- console.error(`No token file for '${name}' — is it attached on this machine? (commonly agent list --local)`);
5986
+ console.error(`No token file for '${name}' — is it attached on this machine? (${CLI} agent list --local)`);
5986
5987
  process.exit(1);
5987
5988
  }
5988
5989
  const instance = opts.instance || record.instanceUrl;
5989
5990
  const ownerToken = getToken(instance);
5990
5991
  const runtimeKey = !opts.adapter && !opts.env && !ownerToken && Boolean(record.runtimeToken);
5991
5992
  const token = runtimeKey ? record.runtimeToken : ownerToken;
5992
- if (!token) { console.error('Not logged in. Run: commonly login'); process.exit(1); }
5993
+ if (!token) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
5993
5994
  try {
5994
5995
  const instanceUrl = resolveInstanceUrl(instance);
5995
5996
  if (runtimeKey && (!record.instanceUrl
5996
5997
  || new URL(instanceUrl).href.replace(/\/$/, '') !== new URL(record.instanceUrl).href.replace(/\/$/, ''))) {
5997
- throw new Error('Changing --instance requires an owner login for that instance; run commonly login');
5998
+ throw new Error(`Changing --instance requires an owner login for that instance; run ${CLI} login`);
5998
5999
  }
5999
6000
  const client = createClient({ instance: instanceUrl, token });
6000
6001
  const result = await updateAgentConfiguration({
@@ -6034,12 +6035,12 @@ Use --local to find the name you'd pass to 'agent run' or 'agent detach'.
6034
6035
  }
6035
6036
  const record = loadAgentToken(name);
6036
6037
  if (!record) {
6037
- console.error(`No token file for '${name}' — is it attached on this machine? (commonly agent list --local)`);
6038
+ console.error(`No token file for '${name}' — is it attached on this machine? (${CLI} agent list --local)`);
6038
6039
  process.exit(1);
6039
6040
  }
6040
6041
  const instanceUrl = resolveInstanceUrl(opts.instance || record.instanceUrl);
6041
6042
  const token = getToken(opts.instance || record.instanceUrl);
6042
- if (!token) { console.error('Not logged in. Run: commonly login'); process.exit(1); }
6043
+ if (!token) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
6043
6044
  const client = createClient({ instance: instanceUrl, token });
6044
6045
  try {
6045
6046
  const result = await setWakeOnMessage({ client, record, enabled });
@@ -6061,12 +6062,12 @@ Use --local to find the name you'd pass to 'agent run' or 'agent detach'.
6061
6062
  .action(async (name, opts) => {
6062
6063
  const record = loadAgentToken(name);
6063
6064
  if (!record) {
6064
- console.error(`No token file for '${name}' — is it attached on this machine? (commonly agent list --local)`);
6065
+ console.error(`No token file for '${name}' — is it attached on this machine? (${CLI} agent list --local)`);
6065
6066
  process.exit(1);
6066
6067
  }
6067
6068
  const instanceUrl = resolveInstanceUrl(opts.instance || record.instanceUrl);
6068
6069
  const token = getToken(opts.instance || record.instanceUrl);
6069
- if (!token) { console.error('Not logged in. Run: commonly login'); process.exit(1); }
6070
+ if (!token) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
6070
6071
  const client = createClient({ instance: instanceUrl, token });
6071
6072
  try {
6072
6073
  const result = await clearUnsandboxedMark({ client, record });
@@ -6085,7 +6086,7 @@ Use --local to find the name you'd pass to 'agent run' or 'agent detach'.
6085
6086
  .option('--instance <url>', 'Target Commonly instance')
6086
6087
  .action(async (name, opts) => {
6087
6088
  const token = getToken(opts.instance);
6088
- if (!token) { console.error('Not logged in. Run: commonly login'); process.exit(1); }
6089
+ if (!token) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
6089
6090
 
6090
6091
  const client = createClient({ instance: resolveInstanceUrl(opts.instance), token });
6091
6092
 
@@ -6109,7 +6110,7 @@ Use --local to find the name you'd pass to 'agent run' or 'agent detach'.
6109
6110
  .action((name, opts) => {
6110
6111
  const record = loadAgentToken(name);
6111
6112
  if (!record?.runtimeToken) {
6112
- console.error(`No runtime token found for '${name}'. Run commonly agent attach first.`);
6113
+ console.error(`No runtime token found for '${name}'. Run ${CLI} agent attach first.`);
6113
6114
  process.exit(1);
6114
6115
  }
6115
6116
  const podId = opts.pod || record.podId;
@@ -57,6 +57,7 @@ import {
57
57
  import { installedCliVersion, startUpdateNotice, UPDATE_CHECK_OPT_OUT_ENV } from '../lib/update-check.js';
58
58
  import { machineHostReport } from '../lib/machine-host.js';
59
59
  import { orchestrateDaemonSetup } from '../lib/stable-install.js';
60
+ import { CLI } from '../lib/cli-hint.js';
60
61
 
61
62
  // launchd, systemd and Task Scheduler hold one Commonly daemon per computer
62
63
  // account. Install refuses to stop another HOME's; this flag takes it over.
@@ -127,7 +128,7 @@ const watchDaemonStatus = async () => {
127
128
  let states = null;
128
129
  let stateNote = '';
129
130
  if (!getToken(record.instanceUrl)) {
130
- stateNote = `Not logged in: showing local process state only. Run: commonly login --instance ${record.instanceUrl}`;
131
+ stateNote = `Not logged in: showing local process state only. Run: ${CLI} login --instance ${record.instanceUrl}`;
131
132
  } else {
132
133
  const podIds = [...new Set(seats.map((seat) => loadAgentToken(seat.recordKey || seat.agentName)?.podId).filter(Boolean))];
133
134
  try {
@@ -171,14 +172,14 @@ const watchDaemonStatus = async () => {
171
172
  const requireDaemonRecord = () => {
172
173
  const record = loadDaemonRecord();
173
174
  if (!record) {
174
- throw new Error('No local daemon is registered. Run: commonly daemon register');
175
+ throw new Error(`No local daemon is registered. Run: ${CLI} daemon register`);
175
176
  }
176
177
  return record;
177
178
  };
178
179
 
179
180
  const requireUserToken = (instance) => {
180
181
  const token = getToken(instance);
181
- if (!token) throw new Error(`Not logged in to ${instance}. Run: commonly login --instance ${instance}`);
182
+ if (!token) throw new Error(`Not logged in to ${instance}. Run: ${CLI} login --instance ${instance}`);
182
183
  return token;
183
184
  };
184
185
 
@@ -274,9 +275,9 @@ const storedDaemonState = async (client, record) => {
274
275
  };
275
276
 
276
277
  export const daemonStatusErrorMessage = (error) => (isRevokedDaemonKey(error)
277
- ? "This computer's old key was revoked. Run: commonly daemon register"
278
+ ? `This computer's old key was revoked. Run: ${CLI} daemon register`
278
279
  : isMissingDaemonMachine(error)
279
- ? 'This computer is no longer registered. Run: commonly daemon register'
280
+ ? `This computer is no longer registered. Run: ${CLI} daemon register`
280
281
  : `Daemon status failed: ${error.message}`);
281
282
 
282
283
  // `daemon setup` on a computer that is already registered for this instance
@@ -299,7 +300,7 @@ export const allowRevokedDaemonReplacement = async ({ existing, client }) => {
299
300
  if (!existing) return null;
300
301
  const state = await storedDaemonState(client, existing);
301
302
  if (state === 'active') {
302
- throw new Error(`A local daemon is already registered for ${existing.machineName}. Run: commonly daemon status`);
303
+ throw new Error(`A local daemon is already registered for ${existing.machineName}. Run: ${CLI} daemon status`);
303
304
  }
304
305
  return state;
305
306
  };
@@ -376,20 +377,20 @@ The daemon token is scoped to this machine and stored in a 0600 file under
376
377
  ~/.commonly/daemon/. It is never shown again after registration.
377
378
 
378
379
  Examples:
379
- $ commonly daemon setup # install, log in, register, and start — one step
380
- $ commonly daemon register --name "Sam's MacBook"
381
- $ commonly daemon heartbeat
382
- $ commonly daemon status --verbose
383
- $ commonly daemon logs --seat my-agent -f
384
- $ commonly daemon start|stop|restart
385
- $ commonly daemon unregister
380
+ $ ${CLI} daemon setup # install, log in, register, and start — one step
381
+ $ ${CLI} daemon register --name "Sam's MacBook"
382
+ $ ${CLI} daemon heartbeat
383
+ $ ${CLI} daemon status --verbose
384
+ $ ${CLI} daemon logs --seat my-agent -f
385
+ $ ${CLI} daemon start|stop|restart
386
+ $ ${CLI} daemon unregister
386
387
  `);
387
388
 
388
389
  daemon
389
390
  .command('setup')
390
391
  .description('From a fresh computer in one step: install the CLI under your home (no sudo, no global install), log in, register this computer, and start the daemon')
391
392
  .option('--instance <url-or-key>', 'Target Commonly instance')
392
- .option(UNSANDBOXED_FLAG, 'Native Windows only: the agents this daemon runs have no sandbox (see `commonly daemon install`). Forwarded to the install step.')
393
+ .option(UNSANDBOXED_FLAG, `Native Windows only: the agents this daemon runs have no sandbox (see \`${CLI} daemon install\`). Forwarded to the install step.`)
393
394
  .option(REPLACE_FLAG, REPLACE_HELP)
394
395
  .action(async (opts) => {
395
396
  try {
@@ -465,11 +466,11 @@ Examples:
465
466
  console.log('Initial heartbeat accepted.');
466
467
  } catch (error) {
467
468
  console.error(`Machine is registered, but its initial heartbeat failed: ${error.message}`);
468
- console.error('Retry with: commonly daemon heartbeat');
469
+ console.error(`Retry with: ${CLI} daemon heartbeat`);
469
470
  process.exitCode = 1;
470
471
  }
471
472
  if (existing && existsSync(servicePaths(process.platform, homedir()).file)) {
472
- console.log('Restart the installed daemon to use the new key: commonly daemon restart');
473
+ console.log(`Restart the installed daemon to use the new key: ${CLI} daemon restart`);
473
474
  }
474
475
  } catch (error) {
475
476
  console.error(`Daemon registration failed: ${error.message}`);
@@ -555,7 +556,7 @@ Examples:
555
556
  const deps = serviceDeps();
556
557
  const target = servicePaths(process.platform, homedir());
557
558
  if (!deps.existsFile(target.file)) {
558
- throw new Error(`No installed daemon service found. Run: commonly daemon install`);
559
+ throw new Error(`No installed daemon service found. Run: ${CLI} daemon install`);
559
560
  }
560
561
  await actionFn({ platform: process.platform, home: homedir(), execCmd: deps.execCmd });
561
562
  console.log(`Daemon ${action} requested (${target.kind}).`);
@@ -582,7 +583,7 @@ Examples:
582
583
  const optedInBefore = loadUnsandboxedOptIn();
583
584
  if (opts.unsandboxed) {
584
585
  saveUnsandboxedOptIn();
585
- console.log('Agents this daemon runs will have no sandbox: they act with your own access to files and commands, and get no connector grants. Codex can run commands in invite-only pods, where anyone in the pod, people you invite later included, can direct it. To turn this off, run: commonly daemon install');
586
+ console.log(`Agents this daemon runs will have no sandbox: they act with your own access to files and commands, and get no connector grants. Codex can run commands in invite-only pods, where anyone in the pod, people you invite later included, can direct it. To turn this off, run: ${CLI} daemon install`);
586
587
  } else if (clearUnsandboxedOptIn()) {
587
588
  console.log('Turned off running without a sandbox: on Windows, agents this daemon runs are refused again until you choose otherwise.');
588
589
  }
@@ -674,14 +675,14 @@ Examples:
674
675
  try {
675
676
  const terminal = loadDaemonStop();
676
677
  if (terminal) {
677
- console.error('Daemon stopped: no valid local registration. Run: commonly daemon register');
678
+ console.error(`Daemon stopped: no valid local registration. Run: ${CLI} daemon register`);
678
679
  process.exitCode = process.platform === 'darwin' ? 0 : terminal.exitCode;
679
680
  return;
680
681
  }
681
682
  record = requireDaemonRecord();
682
683
  const stopped = loadDaemonStop(record);
683
684
  if (stopped) {
684
- console.error("Daemon stopped: this computer's key was revoked. Run: commonly daemon register");
685
+ console.error(`Daemon stopped: this computer's key was revoked. Run: ${CLI} daemon register`);
685
686
  // launchd restarts the first nonzero terminal exit once; a saved
686
687
  // verdict makes that second invocation successful and ends the loop.
687
688
  process.exitCode = process.platform === 'darwin' ? 0 : stopped.exitCode;
@@ -710,7 +711,7 @@ Examples:
710
711
  const name = seatProviderKeyEnv({ adapter: saved?.adapter, environment: saved?.environment });
711
712
  if (!name || process.env[name] || warnedKeys.has(`${agentName}:${name}`)) return;
712
713
  warnedKeys.add(`${agentName}:${name}`);
713
- stampLog(`WARNING: [${agentName}] needs ${name}, which is not set in this environment, so it will fail to start (a provider.keyFile avoids this); export it and re-run: commonly daemon install (docs/agents/daemon-service-environment.md)`);
714
+ stampLog(`WARNING: [${agentName}] needs ${name}, which is not set in this environment, so it will fail to start (a provider.keyFile avoids this); export it and re-run: ${CLI} daemon install (docs/agents/daemon-service-environment.md)`);
714
715
  };
715
716
  // TASK-660: the daemon outlives many publishes, so say once at start-up
716
717
  // when it is stale. Not awaited: supervision never waits on the registry.
@@ -731,7 +732,7 @@ Examples:
731
732
  } catch (error) {
732
733
  stampLog(`could not save revoked-machine stop marker: ${error.message}`);
733
734
  }
734
- stampLog("machine key revoked; stopping supervised agents. Run: commonly daemon register");
735
+ stampLog(`machine key revoked; stopping supervised agents. Run: ${CLI} daemon register`);
735
736
  clearInterval(pollTimer);
736
737
  clearInterval(heartbeatTimer);
737
738
  supervisor.stop();
@@ -856,7 +857,7 @@ Examples:
856
857
  });
857
858
  const lastSeen = machine.lastSeenAt ? new Date(machine.lastSeenAt).toLocaleString() : 'never';
858
859
  console.log(`${machine.name}: ${machine.status} (last heartbeat: ${lastSeen})`);
859
- if (loadUnsandboxedOptIn()) console.log('Sandbox: unsandboxed (opted in). Agents run with your own access and get no connector grants, and anyone in an invite-only pod can direct a Codex agent there. Turn off: commonly daemon install');
860
+ if (loadUnsandboxedOptIn()) console.log(`Sandbox: unsandboxed (opted in). Agents run with your own access and get no connector grants, and anyone in an invite-only pod can direct a Codex agent there. Turn off: ${CLI} daemon install`);
860
861
  if (opts.verbose) {
861
862
  const local = loadDaemonState();
862
863
  if (!local) {
@@ -15,6 +15,7 @@ import { existsSync } from 'fs';
15
15
  import { join } from 'path';
16
16
  import { saveInstance, getToken, LOCAL_URL } from '../lib/config.js';
17
17
  import { createClient } from '../lib/api.js';
18
+ import { CLI } from '../lib/cli-hint.js';
18
19
 
19
20
  const findDevSh = (startDir = process.cwd()) => {
20
21
  let dir = startDir;
@@ -62,13 +63,13 @@ export const registerDev = (program) => {
62
63
 
63
64
  dev.addHelpText('after', `
64
65
  Examples:
65
- $ commonly dev up # Start a local docker-compose stack
66
- $ commonly dev status # Check health
67
- $ commonly dev logs backend # Tail backend logs
68
- $ commonly dev down # Stop everything
66
+ $ ${CLI} dev up # Start a local docker-compose stack
67
+ $ ${CLI} dev status # Check health
68
+ $ ${CLI} dev logs backend # Tail backend logs
69
+ $ ${CLI} dev down # Stop everything
69
70
 
70
71
  Login against the local instance with:
71
- $ commonly login --instance http://localhost:5000
72
+ $ ${CLI} login --instance http://localhost:5000
72
73
  `);
73
74
 
74
75
  dev
@@ -83,7 +84,7 @@ Login against the local instance with:
83
84
  console.log(' Frontend: http://localhost:3000');
84
85
  console.log(' Backend: http://localhost:5000');
85
86
  console.log('\nLogin to local instance:');
86
- console.log(' commonly login --instance http://localhost:5000 --key local');
87
+ console.log(` ${CLI} login --instance http://localhost:5000 --key local`);
87
88
  });
88
89
 
89
90
  dev
@@ -92,8 +93,8 @@ Login against the local instance with:
92
93
  .allowUnknownOption()
93
94
  .allowExcessArguments()
94
95
  .action(() => {
95
- console.error('The local OpenClaw gateway was retired (ADR-021 Part B), so `commonly dev clawdbot` no longer does anything.');
96
- console.error('Use native agents, or attach a local CLI with: commonly agent attach <cli>');
96
+ console.error(`The local OpenClaw gateway was retired (ADR-021 Part B), so \`${CLI} dev clawdbot\` no longer does anything.`);
97
+ console.error(`Use native agents, or attach a local CLI with: ${CLI} agent attach <cli>`);
97
98
  process.exit(1);
98
99
  });
99
100
 
@@ -146,7 +147,7 @@ Login against the local instance with:
146
147
  console.log('Local instance: healthy');
147
148
  console.log(JSON.stringify(data, null, 2));
148
149
  } catch {
149
- console.log('Local instance: not running (start with: commonly dev up)');
150
+ console.log(`Local instance: not running (start with: ${CLI} dev up)`);
150
151
  }
151
152
  });
152
153
  };
@@ -16,6 +16,7 @@ import { detectSeatbelt } from '../lib/sandbox/seatbelt.js';
16
16
  import { daemonStatusErrorMessage, getDaemonMachineStatus } from './daemon.js';
17
17
  import { listLocalAgents, listUnreadableAgentTokens } from './agent.js';
18
18
  import { doctorExitCode, formatDoctorLine, runDoctor } from '../lib/doctor.js';
19
+ import { CLI } from '../lib/cli-hint.js';
19
20
 
20
21
  const REQUEST_TIMEOUT_MS = 5000;
21
22
 
@@ -79,7 +80,7 @@ export const loginTarget = ({
79
80
  key: saved?.key || null,
80
81
  url: resolveUrl(instanceArg),
81
82
  tokenSource: !token ? null : (env.COMMONLY_TOKEN ? 'env' : 'saved'),
82
- loginHint: instanceArg ? `commonly login --instance ${instanceArg}` : 'commonly login',
83
+ loginHint: instanceArg ? `${CLI} login --instance ${instanceArg}` : `${CLI} login`,
83
84
  };
84
85
  };
85
86
 
@@ -133,7 +134,7 @@ export const registerDoctor = (program) => {
133
134
  for (const line of results.map(formatDoctorLine)) console.log(line);
134
135
  process.exitCode = doctorExitCode(results);
135
136
  } catch (error) {
136
- console.error(`commonly doctor could not finish: ${error.message}`);
137
+ console.error(`${CLI} doctor could not finish: ${error.message}`);
137
138
  process.exitCode = 1;
138
139
  }
139
140
  });
@@ -30,6 +30,7 @@ import {
30
30
  INBOX_KINDS,
31
31
  TOKEN_FILE_ENV,
32
32
  } from '../lib/inbox.js';
33
+ import { CLI } from '../lib/cli-hint.js';
33
34
 
34
35
  export const INBOX_TOKEN_HELP = `Account token file (or ${TOKEN_FILE_ENV})`;
35
36
 
@@ -165,7 +166,7 @@ export const runInboxAck = async (itemId, opts = {}, deps = {}) => {
165
166
  env = process.env, fetchImpl = fetch, log = console.log, error = console.error, sleep = undefined,
166
167
  } = deps;
167
168
  try {
168
- if (!itemId) throw new InboxRefusal('an item id is required: commonly inbox ack <attentionItemId>');
169
+ if (!itemId) throw new InboxRefusal(`an item id is required: ${CLI} inbox ack <attentionItemId>`);
169
170
  const {
170
171
  baseUrl, request, account,
171
172
  } = await connect(opts, { env, fetchImpl, sleep });
@@ -180,8 +181,8 @@ export const runInboxAck = async (itemId, opts = {}, deps = {}) => {
180
181
  if (err instanceof InboxRefusal) return reportRefusal(err, error);
181
182
  if (err?.status === 400) {
182
183
  error(`Failed: ${err.message}`);
183
- error('Acknowledge takes the item\'s attentionItemId — the id printed as `item=…` by `commonly inbox list`'
184
- + ' (the unlabelled source id is what `commonly inbox choose` takes).');
184
+ error(`Acknowledge takes the item's attentionItemId — the id printed as \`item=…\` by \`${CLI} inbox list\``
185
+ + ` (the unlabelled source id is what \`${CLI} inbox choose\` takes).`);
185
186
  return 1;
186
187
  }
187
188
  return reportFailure(err, error);
@@ -221,8 +222,8 @@ export const runInboxChoose = async (decisionId, value, opts = {}, deps = {}) =>
221
222
  env = process.env, fetchImpl = fetch, log = console.log, error = console.error, sleep = undefined,
222
223
  } = deps;
223
224
  try {
224
- if (!decisionId) throw new InboxRefusal('a decision id is required: commonly inbox choose <decisionId> <n|label>');
225
- if (value === undefined) throw new InboxRefusal('a value is required: commonly inbox choose <decisionId> <n|label>');
225
+ if (!decisionId) throw new InboxRefusal(`a decision id is required: ${CLI} inbox choose <decisionId> <n|label>`);
226
+ if (value === undefined) throw new InboxRefusal(`a value is required: ${CLI} inbox choose <decisionId> <n|label>`);
226
227
  const {
227
228
  baseUrl, request, account,
228
229
  } = await connect(opts, { env, fetchImpl, sleep });
@@ -256,10 +257,10 @@ export const registerInbox = (program) => {
256
257
  inbox.addHelpText('after', `
257
258
  The account is read from a token file and from nowhere else:
258
259
 
259
- $ commonly inbox list --token-file ~/.commonly/bin/connector-ops-token
260
- $ COMMONLY_TOKEN_FILE=~/.commonly/bin/lily-token commonly inbox list
260
+ $ ${CLI} inbox list --token-file ~/.commonly/bin/connector-ops-token
261
+ $ COMMONLY_TOKEN_FILE=~/.commonly/bin/lily-token ${CLI} inbox list
261
262
 
262
- There is no fallback to the saved login. On a host where \`commonly login\` was
263
+ There is no fallback to the saved login. On a host where \`${CLI} login\` was
263
264
  run once as somebody else, a fallback would print that person's queue while the
264
265
  operator believed they were reading their own. Every run therefore names the
265
266
  account it resolved on its first line.
@@ -268,13 +269,13 @@ With neither --token-file nor COMMONLY_TOKEN_FILE set, the command refuses
268
269
  before it makes a request.
269
270
 
270
271
  Examples:
271
- $ commonly inbox list --json | jq '.items[].title'
272
- $ commonly inbox list --kind decision --pod <podId>
273
- $ commonly inbox list --cursor-file ~/.commonly/inbox/connector-ops.cursor # only what is new
274
- $ commonly inbox list --cursor-file ~/.commonly/inbox/c.cursor --window 300 # widen the re-read to 5m
275
- $ commonly inbox ack <attentionItemId>
276
- $ commonly inbox choose <decisionId> 2 # second option of the card, by position
277
- $ commonly inbox choose <decisionId> "Ship it" # or by its label
272
+ $ ${CLI} inbox list --json | jq '.items[].title'
273
+ $ ${CLI} inbox list --kind decision --pod <podId>
274
+ $ ${CLI} inbox list --cursor-file ~/.commonly/inbox/connector-ops.cursor # only what is new
275
+ $ ${CLI} inbox list --cursor-file ~/.commonly/inbox/c.cursor --window 300 # widen the re-read to 5m
276
+ $ ${CLI} inbox ack <attentionItemId>
277
+ $ ${CLI} inbox choose <decisionId> 2 # second option of the card, by position
278
+ $ ${CLI} inbox choose <decisionId> "Ship it" # or by its label
278
279
 
279
280
  Cost: with no cursor, \`list\` reads the WHOLE queue, one request per 50 items —
280
281
  550 open items is 11 requests. /api/activity is limited to 60 a minute **keyed on
@@ -15,6 +15,7 @@ import {
15
15
  DeviceLoginExpiredError,
16
16
  waitForDeviceAuthorization,
17
17
  } from '../lib/device-login.js';
18
+ import { CLI } from '../lib/cli-hint.js';
18
19
 
19
20
  const prompt = (rl, question) => new Promise((resolve) => rl.question(question, resolve));
20
21
 
@@ -75,9 +76,9 @@ export const registerLogin = (program) => {
75
76
  .option('--password', 'Use the legacy email/password prompt instead of device authorization')
76
77
  .addHelpText('after', `
77
78
  Examples:
78
- $ commonly login # active profile (production on first run)
79
- $ commonly login --instance https://api.commonly.me --key dev # named profile
80
- $ commonly login --instance http://localhost:5000 # saved as "local"
79
+ $ ${CLI} login # active profile (production on first run)
80
+ $ ${CLI} login --instance https://api.commonly.me --key dev # named profile
81
+ $ ${CLI} login --instance http://localhost:5000 # saved as "local"
81
82
 
82
83
  Tokens are stored in ~/.commonly/config.json. Other commands take
83
84
  --instance <url-or-key> to target the right profile.
@@ -141,7 +142,7 @@ Tokens are stored in ~/.commonly/config.json. Other commands take
141
142
  console.log(`Token saved to ~/.commonly/config.json`);
142
143
  } catch (err) {
143
144
  const message = err instanceof DeviceLoginExpiredError
144
- ? `Code expired after 10 minutes. Run commonly login --instance ${configKey} for a new code.`
145
+ ? `Code expired after 10 minutes. Run ${CLI} login --instance ${configKey} for a new code.`
145
146
  : err instanceof DeviceLoginCancelledError || err instanceof DeviceLoginDeniedError
146
147
  ? err.message
147
148
  : `Login failed: ${err.message}`;
@@ -161,7 +162,7 @@ export const registerWhoami = (program) => {
161
162
  const instances = listInstances();
162
163
 
163
164
  if (instances.length === 0) {
164
- console.log('Not logged in. Run: commonly login');
165
+ console.log(`Not logged in. Run: ${CLI} login`);
165
166
  return;
166
167
  }
167
168
 
@@ -187,7 +188,7 @@ export const formatTokenStatus = (token, tokenType, now = Date.now(), instanceKe
187
188
  const expiresAt = decodeJwtExpiry(token);
188
189
  if (!expiresAt) return 'session token · expiry unknown';
189
190
  const diff = expiresAt - now;
190
- if (diff <= 0) return `expired — commonly login --instance ${instanceKey}`;
191
+ if (diff <= 0) return `expired — ${CLI} login --instance ${instanceKey}`;
191
192
  const hours = Math.max(1, Math.ceil(diff / (60 * 60 * 1000)));
192
193
  return `expires in ${hours}h`;
193
194
  };
@@ -5,8 +5,9 @@
5
5
  */
6
6
  import { listLocalAgents, loadAgentToken } from './agent.js';
7
7
  import { validMcpTokenName, writeMcpTokenCopy } from '../lib/mcp-token.js';
8
+ import { CLI } from '../lib/cli-hint.js';
8
9
 
9
- const NO_AGENT_HINT = 'Attach one first: commonly agent attach <adapter> --pod <podId> --name <name>';
10
+ const NO_AGENT_HINT = `Attach one first: ${CLI} agent attach <adapter> --pod <podId> --name <name>`;
10
11
 
11
12
  export const buildMcpConfig = ({ agent } = {}) => {
12
13
  let name = agent;
@@ -22,7 +23,7 @@ export const buildMcpConfig = ({ agent } = {}) => {
22
23
  const record = loadAgentToken(name);
23
24
  const token = String(record?.runtimeToken || '').trim();
24
25
  if (!token) throw new Error(`No runtime token saved for agent '${name}'. ${NO_AGENT_HINT}`);
25
- if (!token.startsWith('cm_agent_')) throw new Error(`The saved token for '${name}' is not a cm_agent_* runtime token. Re-attach it: commonly agent attach`);
26
+ if (!token.startsWith('cm_agent_')) throw new Error(`The saved token for '${name}' is not a cm_agent_* runtime token. Re-attach it: ${CLI} agent attach`);
26
27
  if (!record.instanceUrl) throw new Error(`Agent '${name}' has no saved instance URL. Re-attach it.`);
27
28
 
28
29
  const tokenPath = writeMcpTokenCopy(name, token);
@@ -9,18 +9,19 @@
9
9
  import { createClient } from '../lib/api.js';
10
10
  import { getToken, resolveInstanceUrl } from '../lib/config.js';
11
11
  import { createTailPoller } from '../lib/pod-tail.js';
12
+ import { CLI } from '../lib/cli-hint.js';
12
13
 
13
14
  export const registerPod = (program) => {
14
15
  const pod = program.command('pod').description('Manage pods');
15
16
 
16
17
  pod.addHelpText('after', `
17
18
  Examples:
18
- $ commonly pod list
19
- $ commonly pod send <podId> "hello from the CLI"
20
- $ commonly pod tail <podId>
19
+ $ ${CLI} pod list
20
+ $ ${CLI} pod send <podId> "hello from the CLI"
21
+ $ ${CLI} pod tail <podId>
21
22
 
22
23
  Each command accepts --instance <url-or-key> to target a non-default
23
- Commonly instance (see: commonly login --help).
24
+ Commonly instance (see: ${CLI} login --help).
24
25
  `);
25
26
 
26
27
  // ── list ──────────────────────────────────────────────────────────────────
@@ -30,7 +31,7 @@ Commonly instance (see: commonly login --help).
30
31
  .option('--instance <url>', 'Target Commonly instance')
31
32
  .action(async (opts) => {
32
33
  const token = getToken(opts.instance);
33
- if (!token) { console.error('Not logged in. Run: commonly login'); process.exit(1); }
34
+ if (!token) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
34
35
 
35
36
  const client = createClient({ instance: resolveInstanceUrl(opts.instance), token });
36
37
 
@@ -60,7 +61,7 @@ Commonly instance (see: commonly login --help).
60
61
  .option('--instance <url>', 'Target Commonly instance')
61
62
  .action(async (podId, message, opts) => {
62
63
  const token = getToken(opts.instance);
63
- if (!token) { console.error('Not logged in. Run: commonly login'); process.exit(1); }
64
+ if (!token) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
64
65
 
65
66
  const client = createClient({ instance: resolveInstanceUrl(opts.instance), token });
66
67
 
@@ -93,7 +94,7 @@ Commonly instance (see: commonly login --help).
93
94
  .option('--instance <url>', 'Target Commonly instance')
94
95
  .action(async (podId, opts) => {
95
96
  const token = getToken(opts.instance);
96
- if (!token) { console.error('Not logged in. Run: commonly login'); process.exit(1); }
97
+ if (!token) { console.error(`Not logged in. Run: ${CLI} login`); process.exit(1); }
97
98
 
98
99
  const client = createClient({ instance: resolveInstanceUrl(opts.instance), token });
99
100
 
@@ -31,6 +31,7 @@ import {
31
31
  resolveTaskToken,
32
32
  taskPath,
33
33
  } from '../lib/task.js';
34
+ import { CLI } from '../lib/cli-hint.js';
34
35
 
35
36
  export const TASK_TOKEN_HELP = `Agent token file (or ${TOKEN_FILE_ENV}, or ${TASK_TOKEN_ENV})`;
36
37
 
@@ -191,8 +192,8 @@ export const registerTask = (program) => {
191
192
  task.addHelpText('after', `
192
193
  The board is read and written as the identity in a token file, and nowhere else:
193
194
 
194
- $ commonly task list --pod <podId> --token-file <path>
195
- $ COMMONLY_AGENT_TOKEN=<token> commonly task claim TASK-123 --pod <podId>
195
+ $ ${CLI} task list --pod <podId> --token-file <path>
196
+ $ COMMONLY_AGENT_TOKEN=<token> ${CLI} task claim TASK-123 --pod <podId>
196
197
 
197
198
  The identity is --token-file, then COMMONLY_TOKEN_FILE, then COMMONLY_AGENT_TOKEN.
198
199
  The saved login and COMMONLY_TOKEN are never read: a write made under an
@@ -207,12 +208,12 @@ A claim or a note can refuse with unseen messages in the pod. Read them and retr
207
208
  or pass --continue-anyway to go ahead without reading them.
208
209
 
209
210
  Examples:
210
- $ commonly task list --pod <podId> --status pending,claimed
211
- $ commonly task list --pod <podId> --mine --json
212
- $ commonly task create --pod <podId> --title "Fix the board" --priority P1 --notes "Repro in staging"
213
- $ commonly task claim TASK-123 --pod <podId>
214
- $ commonly task update TASK-123 --pod <podId> --note "PR is up"
215
- $ commonly task close TASK-123 --pod <podId> --pr https://github.com/Team-Commonly/commonly/pull/<n>
211
+ $ ${CLI} task list --pod <podId> --status pending,claimed
212
+ $ ${CLI} task list --pod <podId> --mine --json
213
+ $ ${CLI} task create --pod <podId> --title "Fix the board" --priority P1 --notes "Repro in staging"
214
+ $ ${CLI} task claim TASK-123 --pod <podId>
215
+ $ ${CLI} task update TASK-123 --pod <podId> --note "PR is up"
216
+ $ ${CLI} task close TASK-123 --pod <podId> --pr https://github.com/Team-Commonly/commonly/pull/<n>
216
217
  `);
217
218
 
218
219
  task
package/src/index.js CHANGED
@@ -24,6 +24,7 @@ import { registerVerify } from './commands/verify.js';
24
24
  import { registerDoctor } from './commands/doctor.js';
25
25
  import { registerMcp } from './commands/mcp.js';
26
26
  import { registerTask } from './commands/task.js';
27
+ import { CLI } from './lib/cli-hint.js';
27
28
 
28
29
  const __dirname = dirname(fileURLToPath(import.meta.url));
29
30
  const pkg = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf8'));
@@ -70,24 +71,24 @@ registerTask(program);
70
71
 
71
72
  program.addHelpText('after', `
72
73
  Quick start:
73
- $ commonly login --instance https://api.commonly.me --key dev
74
- $ commonly agent attach claude --pod <podId> --name my-claude
75
- $ commonly agent run my-claude # Ctrl+C to stop
76
- $ commonly agent detach my-claude # clean uninstall
77
- $ commonly daemon register --name "My MacBook"
78
- $ commonly daemon status
79
- $ commonly doctor # check Node, install, login, daemon, adapters
80
- $ commonly inbox list --token-file ~/.commonly/bin/ops-token # an operator's own queue
74
+ $ ${CLI} login --instance https://api.commonly.me --key dev
75
+ $ ${CLI} agent attach claude --pod <podId> --name my-claude
76
+ $ ${CLI} agent run my-claude # Ctrl+C to stop
77
+ $ ${CLI} agent detach my-claude # clean uninstall
78
+ $ ${CLI} daemon register --name "My MacBook"
79
+ $ ${CLI} daemon status
80
+ $ ${CLI} doctor # check Node, install, login, daemon, adapters
81
+ $ ${CLI} inbox list --token-file ~/.commonly/bin/ops-token # an operator's own queue
81
82
 
82
83
  Custom Python agent:
83
- $ commonly agent init --language python --name research-bot --pod <podId>
84
+ $ ${CLI} agent init --language python --name research-bot --pod <podId>
84
85
  $ python3 research-bot.py
85
86
 
86
87
  Subcommand help:
87
- $ commonly login --help
88
- $ commonly agent attach --help
89
- $ commonly agent run --help
90
- $ commonly pod tail --help
88
+ $ ${CLI} login --help
89
+ $ ${CLI} agent attach --help
90
+ $ ${CLI} agent run --help
91
+ $ ${CLI} pod tail --help
91
92
 
92
93
  Note: --instance is a subcommand option, not a program option. It accepts
93
94
  either a saved key name ("dev", "local", "default") or a full URL.
@@ -108,6 +108,7 @@ import { isShippedCommonlyMcpCommand } from '../declared-mcp-guard.js';
108
108
  import { isAnswerableToolError, PUBLIC_MCP_NOT_READY_CODE, PUBLIC_TOOL_FAILED_CODE } from '../public-tool-error.js';
109
109
  import { resolveLaunch, resolveMcpCommand, resolveWindowsCommandWithReason } from '../windows-command.js';
110
110
  import { startProviderProxy } from '../provider-proxy.js';
111
+ import { CLI } from '../cli-hint.js';
111
112
 
112
113
  // See codex.js for the rationale on bumping the default + env override.
113
114
  // Keeping both adapters in lockstep so any wrapper agent runtime has the
@@ -1411,7 +1412,7 @@ const prepareArgv = async (innerArgv, ctx) => {
1411
1412
  throw new Error(
1412
1413
  `${sandboxTrust} Claude agents run inside a sandbox, and Commonly has no sandbox it can enforce on Windows `
1413
1414
  + `(got sandbox.mode=${JSON.stringify(sandboxMode)}). To run this agent without one, which is your choice, `
1414
- + `run commonly agent run <name> ${UNSANDBOXED_FLAG} (or commonly daemon install ${UNSANDBOXED_FLAG} for the agents `
1415
+ + `run ${CLI} agent run <name> ${UNSANDBOXED_FLAG} (or ${CLI} daemon install ${UNSANDBOXED_FLAG} for the agents `
1415
1416
  + 'this computer\'s daemon runs), or choose "Run it here" on the Connect page for a hosted agent.',
1416
1417
  );
1417
1418
  }
package/src/lib/api.js CHANGED
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  import { resolveInstanceUrl, getToken, resolveInstance } from './config.js';
9
+ import { CLI } from './cli-hint.js';
9
10
 
10
11
  const headers = (token, extra = {}) => ({
11
12
  'Content-Type': 'application/json',
@@ -17,7 +18,7 @@ const knownSessionFailure = (body) => [body?.msg, body?.error, body?.message]
17
18
  .some((value) => ['Token is not valid', 'Invalid API token', 'Account no longer exists'].includes(value));
18
19
 
19
20
  export const sessionExpiredMessage = ({ instanceKey, baseUrl }) => (
20
- `Session for ${instanceKey} (${baseUrl}) has expired.\nRun: commonly login --instance ${instanceKey}`
21
+ `Session for ${instanceKey} (${baseUrl}) has expired.\nRun: ${CLI} login --instance ${instanceKey}`
21
22
  );
22
23
 
23
24
  // A non-JSON error body is usually an edge proxy's HTML page; a Cloudflare
@@ -0,0 +1,33 @@
1
+ // The commands this CLI prints for a person to type (F435).
2
+ //
3
+ // npm installs `commonly` and `npx` on Windows as three shims: a `.ps1`, a
4
+ // `.cmd` and a bare sh script. PowerShell picks the `.ps1` first, and its
5
+ // default execution policy (Restricted on a Windows client) refuses to run
6
+ // it, so a printed `commonly daemon install` fails there before it starts.
7
+ // The `.cmd` shim is not a script to PowerShell and runs under any policy, and
8
+ // it runs the same in cmd.exe. So on win32 every hint names `commonly.cmd`,
9
+ // `npx.cmd` or `npm.cmd`; elsewhere the bare name.
10
+ //
11
+ // Windows PowerShell 5.1 has no `&&`, and `;` would run the second step even
12
+ // when the first failed, so steps that depend on each other print one per line
13
+ // on win32 (`cliSteps`).
14
+ //
15
+ // The guard in __tests__/cli-hint.test.mjs fails on a `commonly <subcommand>`
16
+ // written into a string anywhere else in cli/src: use `${CLI} <subcommand>`.
17
+
18
+ export const cliName = (platform = process.platform) => (platform === 'win32' ? 'commonly.cmd' : 'commonly');
19
+ export const npxName = (platform = process.platform) => (platform === 'win32' ? 'npx.cmd' : 'npx');
20
+ export const npmName = (platform = process.platform) => (platform === 'win32' ? 'npm.cmd' : 'npm');
21
+
22
+ export const CLI = cliName();
23
+ export const NPX = npxName();
24
+ export const NPM = npmName();
25
+
26
+ // Commands that run one after another, each only if the one before succeeded.
27
+ // Joined with ` && ` on POSIX shells; on win32, one command per line, each
28
+ // indented by `indent`, so the reader runs them in order.
29
+ export const cliSteps = (steps, { platform = process.platform, indent = ' ' } = {}) => (
30
+ platform === 'win32'
31
+ ? steps.map((step) => `\n${indent}${step}`).join('')
32
+ : steps.join(' && ')
33
+ );
@@ -1,6 +1,18 @@
1
1
  // The hint a foreground `commonly agent run` prints for keeping the agent
2
2
  // running. The daemon supervises only the agents placed on this computer, so
3
3
  // the hint depends on whether a daemon is registered here at all.
4
- export const foregroundDaemonHint = ({ daemonRegistered }) => (daemonRegistered
5
- ? 'foreground mode; this stops when the terminal closes. To keep it running, add the agent to this computer in the web app: Agents → Bring your own → On my computer'
6
- : 'foreground mode; this stops when the terminal closes. To keep it running, add this computer with: commonly daemon register && commonly daemon install, then add the agent to it in the web app: Agents → Bring your own → On my computer');
4
+ //
5
+ // The two daemon steps depend on each other, so on Windows they print one per
6
+ // line instead of joined with `&&`, which Windows PowerShell 5.1 lacks (F435).
7
+ import { cliName, cliSteps } from './cli-hint.js';
8
+
9
+ export const foregroundDaemonHint = ({ daemonRegistered, platform = process.platform }) => {
10
+ const lead = 'foreground mode; this stops when the terminal closes. To keep it running, ';
11
+ const inWebApp = 'the web app: Agents → Bring your own → On my computer';
12
+ if (daemonRegistered) return `${lead}add the agent to this computer in ${inWebApp}`;
13
+ const cli = cliName(platform);
14
+ const steps = cliSteps([`${cli} daemon register`, `${cli} daemon install`], { platform, indent: ' ' });
15
+ return platform === 'win32'
16
+ ? `${lead}add this computer by running these two commands, one after the other:${steps}\n then add the agent to it in ${inWebApp}`
17
+ : `${lead}add this computer with: ${steps}, then add the agent to it in ${inWebApp}`;
18
+ };
@@ -18,6 +18,7 @@ import { basename, join, dirname, resolve } from 'path';
18
18
  import {
19
19
  WINDOWS_TASK_NAME, installWindowsService, uninstallWindowsService, windowsServiceAction, windowsServicePaths,
20
20
  } from './daemon-service-windows.js';
21
+ import { CLI } from './cli-hint.js';
21
22
 
22
23
  export const LAUNCHD_LABEL = 'me.commonly.daemon';
23
24
  export const SYSTEMD_UNIT = 'commonly-daemon.service';
@@ -310,7 +311,7 @@ export const foreignServiceRefusal = ({ target, loadedFile, platform = process.p
310
311
  const own = target.kind === 'schtasks' ? target.launcher : target.file;
311
312
  if (canonicalPath(loadedFile, platform) === canonicalPath(own, platform)) return null;
312
313
  const head = `This computer already runs a Commonly daemon for another account (its service file is ${loadedFile}), `
313
- + 'and installing here would stop it. To see it, run `commonly daemon status` as that account. ';
314
+ + `and installing here would stop it. To see it, run \`${CLI} daemon status\` as that account. `;
314
315
  // The systemd user manager reads units only from its own account's folder,
315
316
  // so a unit written under another HOME is never loaded: --replace can't help,
316
317
  // and neither would uninstalling the other one first.
@@ -322,8 +323,8 @@ export const foreignServiceRefusal = ({ target, loadedFile, platform = process.p
322
323
  };
323
324
 
324
325
  export const installSummary = ({ startsAtBoot }) => (startsAtBoot
325
- ? 'The daemon now starts at boot and is kept alive, so it survives reboots. Uninstall with: commonly daemon uninstall'
326
- : 'The daemon now starts at login and is kept alive. Uninstall with: commonly daemon uninstall');
326
+ ? `The daemon now starts at boot and is kept alive, so it survives reboots. Uninstall with: ${CLI} daemon uninstall`
327
+ : `The daemon now starts at login and is kept alive. Uninstall with: ${CLI} daemon uninstall`);
327
328
 
328
329
  export const installDaemonService = async ({
329
330
  platform = process.platform,
@@ -419,7 +420,7 @@ export const installDaemonService = async ({
419
420
  if (lingerUser) startsAtBoot = await ensureLinger({ username: lingerUser, existsFile, execCmd, warn });
420
421
  }
421
422
  for (const name of missing) {
422
- warn(`${name} is not set in this shell, so it is NOT in the service file. A seat that relies on it will fail to start (one with its own provider.keyFile won't); export it and re-run: commonly daemon install (docs/agents/daemon-service-environment.md)`);
423
+ warn(`${name} is not set in this shell, so it is NOT in the service file. A seat that relies on it will fail to start (one with its own provider.keyFile won't); export it and re-run: ${CLI} daemon install (docs/agents/daemon-service-environment.md)`);
423
424
  }
424
425
  log(`Installed ${target.kind} service (${target.file}). Logs: ${daemonLogPath(home)}`);
425
426
  return { ...target, startsAtBoot };
package/src/lib/doctor.js CHANGED
@@ -16,6 +16,7 @@ import { delimiter, join } from 'node:path';
16
16
  import { DAEMON_SETUP_LINE, runsFromStableInstall } from './stable-install.js';
17
17
  import { parseVersion, versionOlderThan } from './mcp-server-version.js';
18
18
  import { signedOutHint } from './adapter-login.js';
19
+ import { CLI, NPM } from './cli-hint.js';
19
20
 
20
21
  export const PASS = 'pass';
21
22
  export const FAIL = 'fail';
@@ -62,7 +63,7 @@ export const checkInstall = ({
62
63
  pathValue, platform, isExecutable, runVersion, runningVersion, fromSetup = runsFromStableInstall(),
63
64
  }) => {
64
65
  // A `daemon setup` copy is updated by running setup again, never a global install.
65
- const fix = fromSetup ? DAEMON_SETUP_LINE : 'npm install -g @commonlyai/cli';
66
+ const fix = fromSetup ? DAEMON_SETUP_LINE : `${NPM} install -g @commonlyai/cli`;
66
67
  const found = findOnPath({ command: 'commonly', pathValue, platform, isExecutable });
67
68
  if (!found.length) return result('install', FAIL, 'no `commonly` on PATH', fix);
68
69
  const [binary] = found;
@@ -94,7 +95,7 @@ export const checkLogin = async ({ target, fetchUser }) => {
94
95
  if ([401, 403].includes(error?.status)) {
95
96
  return result('login', FAIL, `${where} rejected ${tokenName}`, refix);
96
97
  }
97
- return result('login', FAIL, `could not reach ${target.url}: ${error?.message || error}`, 'check the network, then re-run commonly doctor');
98
+ return result('login', FAIL, `could not reach ${target.url}: ${error?.message || error}`, `check the network, then re-run ${CLI} doctor`);
98
99
  }
99
100
  const who = user?.username || user?.email || user?._id;
100
101
  if (!who) return result('login', FAIL, `${where} answered without a user`, refix);
@@ -125,17 +126,17 @@ export const checkDaemon = async ({
125
126
  }
126
127
  const name = record.machineName || 'this computer';
127
128
  if (!fileExists(serviceFile)) {
128
- return result('daemon', FAIL, `${name} is registered but its login service is not installed (${serviceFile})`, 'commonly daemon install');
129
+ return result('daemon', FAIL, `${name} is registered but its login service is not installed (${serviceFile})`, `${CLI} daemon install`);
129
130
  }
130
131
  let machine;
131
132
  try {
132
133
  machine = await fetchMachine(record);
133
134
  } catch (error) {
134
- return result('daemon', FAIL, describeError(error), 'commonly daemon status');
135
+ return result('daemon', FAIL, describeError(error), `${CLI} daemon status`);
135
136
  }
136
137
  const heard = `last heartbeat ${ago(machine?.lastSeenAt, now)}`;
137
138
  if (machine?.status !== 'online') {
138
- return result('daemon', FAIL, `${machine?.name || name} is ${machine?.status || 'unknown'}, ${heard}`, 'commonly daemon restart, then commonly daemon logs');
139
+ return result('daemon', FAIL, `${machine?.name || name} is ${machine?.status || 'unknown'}, ${heard}`, `${CLI} daemon restart, then ${CLI} daemon logs`);
139
140
  }
140
141
  return result('daemon', PASS, `${machine.name || name} online, service installed, ${heard}`);
141
142
  };
@@ -159,7 +160,7 @@ export const checkAdapters = async ({ agents, getAdapter, unreadable = [] }) =>
159
160
  byAdapter.get(adapter).push(agent.name);
160
161
  }
161
162
  const unreadableLine = unreadable.length
162
- ? [result('adapters', FAIL, `the token file of ${nameList(unreadable)} is not readable JSON (~/.commonly/tokens)`, 'commonly agent detach <name> --force, then attach it again')]
163
+ ? [result('adapters', FAIL, `the token file of ${nameList(unreadable)} is not readable JSON (~/.commonly/tokens)`, `${CLI} agent detach <name> --force, then attach it again`)]
163
164
  : [];
164
165
  if (!byAdapter.size) {
165
166
  return unreadableLine.length ? unreadableLine : [result('adapters', SKIP, 'no agents are attached on this computer')];
@@ -169,12 +170,12 @@ export const checkAdapters = async ({ agents, getAdapter, unreadable = [] }) =>
169
170
  const id = `adapter:${name}`;
170
171
  const used = `used by ${nameList(agentNames)}`;
171
172
  if (name === '?') {
172
- results.push(result(id, FAIL, `no adapter recorded in the token file, ${used}`, 'commonly agent detach <name> --force, then attach it again'));
173
+ results.push(result(id, FAIL, `no adapter recorded in the token file, ${used}`, `${CLI} agent detach <name> --force, then attach it again`));
173
174
  continue;
174
175
  }
175
176
  const adapter = getAdapter(name);
176
177
  if (!adapter) {
177
- results.push(result(id, FAIL, `unknown adapter '${name}', ${used}`, `commonly agent detach <name> --force, then attach it again`));
178
+ results.push(result(id, FAIL, `unknown adapter '${name}', ${used}`, `${CLI} agent detach <name> --force, then attach it again`));
178
179
  continue;
179
180
  }
180
181
  if (typeof adapter.detect !== 'function') {
@@ -225,7 +226,7 @@ export const checkMacClaude = ({
225
226
  // A failed preflight most often means doctor itself is inside a sandbox
226
227
  // (an agent's turn), where a nested sandbox-exec is refused.
227
228
  const fixes = [];
228
- if (!seatbelt?.available) fixes.push('run commonly doctor from a normal Terminal, not from inside an agent\'s sandbox');
229
+ if (!seatbelt?.available) fixes.push(`run ${CLI} doctor from a normal Terminal, not from inside an agent's sandbox`);
229
230
  if (missing.length > (seatbelt?.available ? 0 : 1)) {
230
231
  fixes.push('sign in to this Mac as the user the agent runs as, and run claude once to log in');
231
232
  }
@@ -26,6 +26,7 @@
26
26
  * turn's own provider, so it never counts (public-tool-error.js).
27
27
  */
28
28
  import { PUBLIC_MCP_NOT_READY_CODE, PUBLIC_TOOL_FAILED_CODE } from './public-tool-error.js';
29
+ import { CLI } from './cli-hint.js';
29
30
 
30
31
  /** How long one model's hint stays posted before the seat may post it again. */
31
32
  export const MODEL_UNAVAILABLE_HINT_WINDOW_MS = 60 * 60 * 1000;
@@ -149,5 +150,5 @@ export const modelUnavailableHint = (model, { cliAgentName = null } = {}) => {
149
150
  return `${what} To change it, open the agent's Settings, then How it runs, then Model.`;
150
151
  }
151
152
  const name = CLI_AGENT_NAME_RE.test(cliAgentName) ? cliAgentName : '<name>';
152
- return `${what} To change it, run commonly agent config ${name} --model <model> on the computer it runs on, then restart commonly agent run ${name}.`;
153
+ return `${what} To change it, run ${CLI} agent config ${name} --model <model> on the computer it runs on, then restart ${CLI} agent run ${name}.`;
153
154
  };
package/src/lib/poller.js CHANGED
@@ -10,6 +10,7 @@ import { createClient } from './api.js';
10
10
  import { formatDigestFrame } from './digest-frame.js';
11
11
  import { EMPTY_OUTPUT } from './claim-outcome.js';
12
12
  import { createPollLiveness, formatStall, resolvePollLivenessMs } from './poll-liveness.js';
13
+ import { CLI } from './cli-hint.js';
13
14
 
14
15
  // Delivery failures that must stop a consumer rather than fall through to the
15
16
  // normal at-least-once retry path. A stale delivery belongs to a replacement
@@ -168,7 +169,7 @@ export const startPoller = ({
168
169
  `Runtime token rejected ${consecutiveAuthErrors} times in a row — stopping poller. `
169
170
  + `This connection takes its key from --token, then COMMONLY_TOKEN, then your saved login. `
170
171
  + `If the key was rotated or revoked, re-run with the new key in --token or COMMONLY_TOKEN; `
171
- + `with neither set, run commonly login${loginInstance ? ` --instance ${loginInstance}` : ''}.`,
172
+ + `with neither set, run ${CLI} login${loginInstance ? ` --instance ${loginInstance}` : ''}.`,
172
173
  ));
173
174
  running = false;
174
175
  return;
@@ -21,6 +21,7 @@ import { normalizeSandboxTrust } from '../environment.js';
21
21
  import { PUBLIC_SANDBOX_MODES, resolvePublicSandboxMode } from './mode.js';
22
22
  import { detectBwrap as defaultDetectBwrap } from './bwrap.js';
23
23
  import { detectSeatbelt as defaultDetectSeatbelt } from './seatbelt.js';
24
+ import { CLI } from '../cli-hint.js';
24
25
 
25
26
  // D245: the Windows opt-in (windows-unsandboxed.js re-exports it; defined here to avoid an import cycle).
26
27
  export const UNSANDBOXED_FLAG = '--unsandboxed';
@@ -50,7 +51,7 @@ const CODEX_WINDOWS_MESSAGE = [
50
51
  "Codex can't enforce a sandbox on Windows without its elevated setup,",
51
52
  'so by default this agent cannot listen for @mentions from native Windows. You can:',
52
53
  ` - In invite-only pods, run it without a sandbox: add ${UNSANDBOXED_FLAG}`
53
- + ` (commonly agent run <name> ${UNSANDBOXED_FLAG}, or commonly daemon install ${UNSANDBOXED_FLAG}).`
54
+ + ` (${CLI} agent run <name> ${UNSANDBOXED_FLAG}, or ${CLI} daemon install ${UNSANDBOXED_FLAG}).`
54
55
  + ' Nothing confines it: it runs with your own access to files and commands, anyone in the pod,'
55
56
  + ' people you invite later included, can direct it, and it gets no connector grants.',
56
57
  CODEX_WSL_LINE,
@@ -134,7 +135,7 @@ export const windowsSandboxMessage = (adapterName) => {
134
135
  // D245: the user's own choice, never a default (sandbox/windows-unsandboxed.js).
135
136
  ...(adapterName === 'claude'
136
137
  ? [` - Run it without an OS sandbox: add ${UNSANDBOXED_FLAG}`
137
- + ` (commonly agent run <name> ${UNSANDBOXED_FLAG}, or commonly daemon install ${UNSANDBOXED_FLAG}).`
138
+ + ` (${CLI} agent run <name> ${UNSANDBOXED_FLAG}, or ${CLI} daemon install ${UNSANDBOXED_FLAG}).`
138
139
  + " It keeps Commonly's restricted tool settings and gets no shell, but nothing at the OS level confines it, and it gets no connector grants."]
139
140
  : []),
140
141
  ...(adapterName === 'claude'
@@ -24,6 +24,7 @@ import { existsSync, mkdirSync, readFileSync } from 'fs';
24
24
  import { homedir } from 'os';
25
25
  import { join, sep } from 'path';
26
26
  import { resolveLaunch } from './windows-command.js';
27
+ import { NPX } from './cli-hint.js';
27
28
 
28
29
  export const CLI_PACKAGE = '@commonlyai/cli';
29
30
 
@@ -35,7 +36,7 @@ export const MIN_NODE_MAJOR = 22;
35
36
  // version that invoked it, so what runs resident is what the user installed.
36
37
  export const stableCliDir = (home = homedir()) => join(home, '.commonly', 'cli');
37
38
  /** The one line that sets up or updates a computer, for advice the CLI prints. */
38
- export const DAEMON_SETUP_LINE = `npx -y ${CLI_PACKAGE}@latest daemon setup`;
39
+ export const DAEMON_SETUP_LINE = `${NPX} -y ${CLI_PACKAGE}@latest daemon setup`;
39
40
 
40
41
  /** True when this process runs the copy `daemon setup` installed under $HOME. */
41
42
  export const runsFromStableInstall = (entry = process.argv[1], home = homedir()) => (
package/src/lib/task.js CHANGED
@@ -13,6 +13,7 @@
13
13
  import { readFileSync } from 'fs';
14
14
  import { DEFAULT_URL, resolveInstance } from './config.js';
15
15
  import { extractToken, resolveTokenFilePath, TOKEN_FILE_ENV } from './inbox.js';
16
+ import { CLI } from './cli-hint.js';
16
17
 
17
18
  export const API_URL_ENV = 'COMMONLY_API_URL';
18
19
  export const TASK_TOKEN_ENV = 'COMMONLY_AGENT_TOKEN';
@@ -62,10 +63,10 @@ export const checkStatusFilter = (value) => {
62
63
  export const checkUpdateStatus = (value) => {
63
64
  const status = String(value).trim().toLowerCase();
64
65
  if (status === 'claimed') {
65
- throw new TaskRefusal('--status claimed is refused: `commonly task claim` writes the lease, and a bare status does not.');
66
+ throw new TaskRefusal(`--status claimed is refused: \`${CLI} task claim\` writes the lease, and a bare status does not.`);
66
67
  }
67
68
  if (status === 'done') {
68
- throw new TaskRefusal('--status done is refused: `commonly task close` stamps completedAt and the PR, and PATCH does not.');
69
+ throw new TaskRefusal(`--status done is refused: \`${CLI} task close\` stamps completedAt and the PR, and PATCH does not.`);
69
70
  }
70
71
  if (!UPDATE_STATUSES.includes(status)) {
71
72
  throw new TaskRefusal(`--status must be ${UPDATE_STATUSES.join(' or ')} (got '${value}').`);
@@ -18,6 +18,7 @@ import { homedir } from 'node:os';
18
18
  import { dirname, join } from 'node:path';
19
19
  import { exactVersion, parseVersion } from './mcp-server-version.js';
20
20
  import { DAEMON_SETUP_LINE, runsFromStableInstall } from './stable-install.js';
21
+ import { NPM } from './cli-hint.js';
21
22
 
22
23
  export const CLI_PACKAGE = '@commonlyai/cli';
23
24
  export const REGISTRY_LATEST_URL = 'https://registry.npmjs.org/@commonlyai%2fcli/latest';
@@ -58,7 +59,7 @@ export const updateNoticeLine = ({
58
59
  const gap = Number.isFinite(behind) ? `${behind} versions behind` : 'behind a newer release line';
59
60
  // A `daemon setup` copy lives under $HOME and has no global install to update;
60
61
  // running setup again updates it and restarts the daemon.
61
- const update = fromSetup ? DAEMON_SETUP_LINE : `npm install -g ${CLI_PACKAGE}@latest`;
62
+ const update = fromSetup ? DAEMON_SETUP_LINE : `${NPM} install -g ${CLI_PACKAGE}@latest`;
62
63
  return `your CLI is ${gap} (installed ${from}, latest ${to}). Update: ${update}`
63
64
  + ` (silence with ${UPDATE_CHECK_OPT_OUT_ENV}=1)`;
64
65
  };