clario-agent 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +6 -7
  2. package/cli.mjs +19 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -9,14 +9,13 @@ clears when the agent finishes.
9
9
  ## Setup (one command)
10
10
 
11
11
  1. Open your space on [clario.games](https://www.clario.games) and click **Agent** in the
12
- left menu. Pick your agent; it shows your setup command, with your key in it:
12
+ left menu. It shows your setup command, with your key in it:
13
13
  ```bash
14
- npx clario-agent setup --key YOUR_KEY # Claude Code
15
- npx clario-agent setup --key YOUR_KEY --agent codex # Codex
16
- npx clario-agent setup --key YOUR_KEY --agent cursor # Cursor
14
+ npx clario-agent@latest setup --key YOUR_KEY
17
15
  ```
18
- 2. Copy it and run it in the terminal, inside the project you want to share.
19
- `--agent all` sets up all three; `--agent codex,cursor` works too.
16
+ 2. Copy it and run it in the terminal, inside the project you want to share. It sets up
17
+ every agent it finds on your computer (Claude Code, Codex, Cursor). To pick them
18
+ yourself, add `--agent codex`, `--agent claude,cursor` or `--agent all`.
20
19
 
21
20
  That's it: the Agent button disappears once your agent has connected. Setup:
22
21
 
@@ -41,7 +40,7 @@ That's it: the Agent button disappears once your agent has connected. Setup:
41
40
  Then give your agent a task in that project and click your avatar. Teammates who do the same
42
41
  and join your space show up on their avatars too.
43
42
 
44
- To add another project later, run `npx clario-agent setup --agent …` there: it reuses your
43
+ To add another project or a newly installed agent later, run `npx clario-agent@latest setup` there: it reuses your
45
44
  saved key. Setup never registers the hook twice, leaves your other settings and hooks as they
46
45
  are, and saves the previous file next to it as `*.clario-backup`.
47
46
 
package/cli.mjs CHANGED
@@ -4,6 +4,7 @@
4
4
  * your Clario avatar.
5
5
  *
6
6
  * npx clario-agent setup --key KEY [--agent claude|codex|cursor|all] [--api-url URL] [--global]
7
+ * every agent on this computer unless --agent picks
7
8
  * npx clario-agent status what is set up
8
9
  * npx clario-agent uninstall [--global] stop sharing from this project (or everywhere)
9
10
  *
@@ -47,6 +48,8 @@ const quote = (path) => `"${path.replace(/(["\\$`])/g, "\\$1")}"`;
47
48
  const AGENT_TARGETS = {
48
49
  claude: {
49
50
  name: "Claude Code",
51
+ // Each agent makes its home folder the first time it runs: that's how setup finds it.
52
+ installed: () => existsSync(join(homedir(), ".claude")),
50
53
  file: (global) => (global ? join(homedir(), ".claude", "settings.json") : join(process.cwd(), ".claude", "settings.local.json")),
51
54
  events: ["PreToolUse", "PostToolUse", "Stop", "SessionEnd"],
52
55
  command: () => `node ${quote(HOOK_PATH)}`,
@@ -54,6 +57,7 @@ const AGENT_TARGETS = {
54
57
  codex: {
55
58
  name: "Codex",
56
59
  shared: true, // one file for every project
60
+ installed: () => existsSync(process.env.CODEX_HOME || join(homedir(), ".codex")),
57
61
  file: () => join(process.env.CODEX_HOME || join(homedir(), ".codex"), "hooks.json"),
58
62
  events: ["UserPromptSubmit", "PostToolUse", "Stop", "SessionEnd"],
59
63
  // The full path to node: Codex and Cursor can start hooks without your shell's PATH.
@@ -63,6 +67,7 @@ const AGENT_TARGETS = {
63
67
  name: "Cursor",
64
68
  shared: true,
65
69
  flat: true, // { version: 1, hooks: { event: [{ command }] } }
70
+ installed: () => existsSync(join(homedir(), ".cursor")),
66
71
  file: () => join(homedir(), ".cursor", "hooks.json"),
67
72
  events: ["beforeSubmitPrompt", "afterFileEdit", "stop"],
68
73
  command: () => `${quote(process.execPath)} ${quote(HOOK_PATH)} --agent cursor-agent`,
@@ -219,7 +224,10 @@ function gitIgnored(file) {
219
224
  }
220
225
  }
221
226
 
222
- /** --agent claude|codex|cursor|all, repeatable or comma separated; Claude Code when left out. */
227
+ /**
228
+ * --agent claude|codex|cursor|all, repeatable or comma separated. Left out: every agent on
229
+ * this computer (Claude Code when none is found), so one command sets up all of them.
230
+ */
223
231
  function parseAgents(args) {
224
232
  const values = args
225
233
  .flatMap((arg, i) => (arg === "--agent" ? [args[i + 1] ?? ""] : arg.startsWith("--agent=") ? [arg.slice("--agent=".length)] : []))
@@ -230,7 +238,9 @@ function parseAgents(args) {
230
238
  const names = values.includes("all") ? Object.keys(AGENT_TARGETS) : values.map((value) => aliases[value] ?? value);
231
239
  const unknown = names.find((name) => !(name in AGENT_TARGETS));
232
240
  if (unknown !== undefined) fail(`Unknown agent "${unknown}". Use claude, codex, cursor or all.`);
233
- return names.length ? [...new Set(names)] : ["claude"];
241
+ if (names.length) return [...new Set(names)];
242
+ const found = Object.keys(AGENT_TARGETS).filter((name) => AGENT_TARGETS[name].installed());
243
+ return found.length ? found : ["claude"];
234
244
  }
235
245
 
236
246
  // ---- Commands -----------------------------------------------------------------------
@@ -266,6 +276,10 @@ async function setup(opts) {
266
276
  if (agent === "codex") console.log(" Codex asks before it runs a new hook: open Codex, run /hooks and trust the Clario hook.");
267
277
  if (agent === "cursor") console.log(" If Cursor is open, restart it so it loads the hook.");
268
278
  }
279
+ const missing = Object.keys(AGENT_TARGETS).filter((agent) => !opts.agents.includes(agent));
280
+ if (!opts.picked && missing.length) {
281
+ console.log(`Not found on this computer: ${missing.map((agent) => AGENT_TARGETS[agent].name).join(", ")}. Run setup again after installing one.`);
282
+ }
269
283
  console.log("Open your Clario space and give your agent a task: your avatar's card shows what it's doing.");
270
284
  }
271
285
 
@@ -323,7 +337,8 @@ const HELP = `clario-agent: show what your coding agent is doing on your Clario
323
337
  clario-agent uninstall [--global] stop sharing from this project (or everywhere)
324
338
 
325
339
  Get the setup command (with your key) from the Agent button in your Clario space.
326
- --agent picks which agents to set up (default claude; comma separated or repeated).
340
+ Setup registers every agent it finds on this computer; --agent picks them yourself
341
+ (comma separated or repeated).
327
342
  Without --global only the project you run it in is shared. Without --key, setup reuses
328
343
  the key you saved before. The server is ${DEFAULT_API_URL} unless you pass --api-url.`;
329
344
 
@@ -334,7 +349,7 @@ export async function run(argv) {
334
349
  return i > -1 ? rest[i + 1] : undefined;
335
350
  };
336
351
  try {
337
- const opts = { global: rest.includes("--global"), apiUrl: value("--api-url"), key: value("--key"), agents: parseAgents(rest) };
352
+ const opts = { global: rest.includes("--global"), apiUrl: value("--api-url"), key: value("--key"), agents: parseAgents(rest), picked: rest.some((arg) => arg.startsWith("--agent")) };
338
353
  if (command === "setup") await setup(opts);
339
354
  else if (command === "status") status();
340
355
  else if (command === "uninstall") uninstall(opts);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clario-agent",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Show what your Claude Code, Codex or Cursor agent is doing (project, branch, commit) on your Clario avatar.",
5
5
  "type": "module",
6
6
  "bin": {