turno-cli 0.1.1 → 0.3.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 (121) hide show
  1. package/CHANGELOG.md +432 -0
  2. package/README.md +228 -73
  3. package/dist/accounts/audit.js +154 -12
  4. package/dist/accounts/builtin.js +100 -25
  5. package/dist/accounts/delegate.js +199 -35
  6. package/dist/accounts/policy.js +79 -0
  7. package/dist/accounts/registry.js +39 -21
  8. package/dist/agents/adapter.js +29 -0
  9. package/dist/agents/claude.js +246 -0
  10. package/dist/agents/codex.js +186 -0
  11. package/dist/agents/copilot.js +56 -0
  12. package/dist/agents/cursor.js +58 -0
  13. package/dist/agents/index.js +26 -86
  14. package/dist/agents/snippets.js +43 -13
  15. package/dist/cli/args.js +38 -6
  16. package/dist/cli/commands/accounts.js +119 -52
  17. package/dist/cli/commands/auto.js +121 -33
  18. package/dist/cli/commands/browser-identity.js +514 -0
  19. package/dist/cli/commands/browser-session.js +102 -0
  20. package/dist/cli/commands/browser-vault.js +193 -0
  21. package/dist/cli/commands/browser.js +319 -138
  22. package/dist/cli/commands/complete.js +14 -3
  23. package/dist/cli/commands/completion.js +8 -2
  24. package/dist/cli/commands/config.js +186 -24
  25. package/dist/cli/commands/demo.js +321 -0
  26. package/dist/cli/commands/doctor.js +525 -123
  27. package/dist/cli/commands/handoff.js +33 -22
  28. package/dist/cli/commands/identity.js +192 -54
  29. package/dist/cli/commands/init.js +648 -0
  30. package/dist/cli/commands/limit.js +84 -16
  31. package/dist/cli/commands/mcp-call.js +240 -0
  32. package/dist/cli/commands/mcp-oauth.js +221 -0
  33. package/dist/cli/commands/mcp-observe.js +539 -0
  34. package/dist/cli/commands/mcp-share.js +201 -0
  35. package/dist/cli/commands/mcp.js +816 -187
  36. package/dist/cli/commands/mcpd.js +388 -76
  37. package/dist/cli/commands/migrate.js +6 -4
  38. package/dist/cli/commands/open.js +115 -27
  39. package/dist/cli/commands/profile.js +396 -78
  40. package/dist/cli/commands/resolve.js +14 -3
  41. package/dist/cli/commands/run.js +36 -6
  42. package/dist/cli/commands/secret.js +80 -76
  43. package/dist/cli/commands/session.js +17 -6
  44. package/dist/cli/commands/sessions.js +48 -12
  45. package/dist/cli/commands/setup.js +214 -164
  46. package/dist/cli/commands/status.js +227 -44
  47. package/dist/cli/commands/statusline.js +311 -114
  48. package/dist/cli/commands/ui.js +78 -68
  49. package/dist/cli/commands/undo.js +193 -18
  50. package/dist/cli/commands/uninstall.js +481 -0
  51. package/dist/cli/commands/upgrade.js +172 -79
  52. package/dist/cli/commands/usage.js +125 -51
  53. package/dist/cli/commands/version.js +21 -7
  54. package/dist/cli/commands/which.js +9 -24
  55. package/dist/cli/compile-cache.js +32 -0
  56. package/dist/cli/diagnostics.js +184 -0
  57. package/dist/cli/exit.js +65 -0
  58. package/dist/cli/group.js +24 -12
  59. package/dist/cli/help.js +62 -0
  60. package/dist/cli/highlight.js +236 -0
  61. package/dist/cli/hints.js +30 -0
  62. package/dist/cli/io.js +186 -1
  63. package/dist/cli/launch.js +52 -39
  64. package/dist/cli/launchers.js +161 -95
  65. package/dist/cli/main.js +201 -31
  66. package/dist/cli/optional.js +144 -0
  67. package/dist/cli/output.js +123 -0
  68. package/dist/cli/picker.js +459 -0
  69. package/dist/cli/registry.js +61 -6
  70. package/dist/cli/safe.js +87 -0
  71. package/dist/cli/secret-input.js +63 -0
  72. package/dist/cli/security.js +561 -0
  73. package/dist/cli/style.js +311 -0
  74. package/dist/cli/topics.js +142 -0
  75. package/dist/core/config.js +181 -23
  76. package/dist/core/exhausted.js +6 -8
  77. package/dist/core/fsutil.js +39 -0
  78. package/dist/core/journal.js +294 -16
  79. package/dist/core/manifest.js +153 -6
  80. package/dist/core/paths.js +14 -13
  81. package/dist/core/profiles.js +160 -10
  82. package/dist/core/resolve.js +139 -23
  83. package/dist/core/secrets.js +68 -23
  84. package/dist/core/sessions.js +13 -20
  85. package/dist/core/state-file.js +107 -0
  86. package/dist/core/update.js +31 -18
  87. package/dist/core/version.js +57 -10
  88. package/dist/demo/server.js +42 -0
  89. package/dist/mcpd/cache.js +23 -10
  90. package/dist/mcpd/calllog.js +254 -0
  91. package/dist/mcpd/client-names.js +46 -0
  92. package/dist/mcpd/connectors.js +188 -18
  93. package/dist/mcpd/daemon.js +472 -115
  94. package/dist/mcpd/folder-sets.js +42 -0
  95. package/dist/mcpd/gateway.js +473 -51
  96. package/dist/mcpd/health.js +313 -0
  97. package/dist/mcpd/importer.js +453 -36
  98. package/dist/mcpd/instances.js +453 -65
  99. package/dist/mcpd/jsonrpc.js +11 -1
  100. package/dist/mcpd/launchd.js +65 -48
  101. package/dist/mcpd/middleware.js +144 -0
  102. package/dist/mcpd/modern.js +686 -0
  103. package/dist/mcpd/oauth.js +845 -0
  104. package/dist/mcpd/peerpid.js +134 -6
  105. package/dist/mcpd/pressure.js +88 -0
  106. package/dist/mcpd/rss.js +166 -0
  107. package/dist/mcpd/service.js +191 -0
  108. package/dist/mcpd/share.js +217 -0
  109. package/dist/mcpd/state.js +183 -0
  110. package/dist/mcpd/sync.js +72 -87
  111. package/dist/mcpd/systemd.js +83 -0
  112. package/dist/mcpd/tokens.js +85 -0
  113. package/dist/mcpd/upstream.js +163 -46
  114. package/dist/statusline/cost.js +167 -44
  115. package/dist/statusline/input.js +78 -0
  116. package/dist/statusline/render.js +9 -3
  117. package/dist/ui/fonts.js +8 -3
  118. package/dist/ui/settings.js +33 -16
  119. package/npm-shrinkwrap.json +1102 -0
  120. package/package.json +10 -9
  121. package/dist/cli/commands/available.js +0 -18
@@ -1,11 +1,13 @@
1
- import { existsSync, readFileSync, readdirSync, realpathSync } from "node:fs";
1
+ import { existsSync, readFileSync, readdirSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { loadConfig } from "../../core/config.js";
4
4
  import { paths, profileDir } from "../../core/paths.js";
5
5
  import { listProfiles, profileFromConfigDir } from "../../core/profiles.js";
6
+ import { bool, flagsOf, parseFlags } from "../args.js";
6
7
  import { fail } from "../io.js";
8
+ import { realOr } from "../../core/fsutil.js";
7
9
  const USAGE = `Usage:
8
- turno handoff <profile|auto> [--fork] [--copy]
10
+ turno session handoff [profile|auto] [--fork] [--copy]
9
11
 
10
12
  Prints the command that continues THIS Claude Code session under another profile:
11
13
  default resume it there (exit this session first)
@@ -14,12 +16,15 @@ Prints the command that continues THIS Claude Code session under another profile
14
16
 
15
17
  Run it from inside a Claude Code session (it reads CLAUDE_CODE_SESSION_ID). The command starts
16
18
  with a cd to the folder the session began in, because claude --resume looks sessions up by
17
- the project folder it is launched from.`;
19
+ the project folder it is launched from.
20
+
21
+ Without a profile, a terminal shows the profiles to choose from; elsewhere it exits with 2
22
+ and lists them.`;
18
23
  function shellQuote(s) {
19
24
  return /^[A-Za-z0-9_./:@%+=-]+$/.test(s) ? s : `'${s.replace(/'/g, "'\\''")}'`;
20
25
  }
21
26
  /** The first `cwd` recorded in a transcript: where the session started. */
22
- export function transcriptCwd(file) {
27
+ function transcriptCwd(file) {
23
28
  const text = readFileSync(file, "utf8");
24
29
  for (const line of text.split("\n")) {
25
30
  if (!line.includes('"cwd"'))
@@ -35,7 +40,7 @@ export function transcriptCwd(file) {
35
40
  }
36
41
  return undefined;
37
42
  }
38
- export function findTranscript(configDir, sessionId) {
43
+ function findTranscript(configDir, sessionId) {
39
44
  const projects = join(configDir, "projects");
40
45
  if (!existsSync(projects))
41
46
  return undefined;
@@ -46,14 +51,6 @@ export function findTranscript(configDir, sessionId) {
46
51
  }
47
52
  return undefined;
48
53
  }
49
- function real(p) {
50
- try {
51
- return realpathSync(p);
52
- }
53
- catch {
54
- return p;
55
- }
56
- }
57
54
  export function buildHandoff(target, fork, env) {
58
55
  const sid = env.CLAUDE_CODE_SESSION_ID;
59
56
  if (!sid)
@@ -74,8 +71,8 @@ export function buildHandoff(target, fork, env) {
74
71
  const current = profileFromConfigDir(env.CLAUDE_CONFIG_DIR, config, env);
75
72
  if (!fork && target === current)
76
73
  warnings.push(`this session already runs as '${target}'`);
77
- if (target !== "auto" && real(join(cfg, "projects")) !== real(join(profileDir(target, env), "projects"))) {
78
- warnings.push(`${target} does not share the projects folder with this profile, so it will not see this session (turno setup ${target})`);
74
+ if (target !== "auto" && realOr(join(cfg, "projects")) !== realOr(join(profileDir(target, env), "projects"))) {
75
+ warnings.push(`${target} does not share the projects folder with this profile, so it will not see this session (turno profile repair ${target})`);
79
76
  }
80
77
  const command = `cd ${shellQuote(cwd)} && turno ${target} --resume ${sid}${fork ? " --fork-session" : ""}`;
81
78
  return { command, warnings };
@@ -94,23 +91,37 @@ async function copy(text) {
94
91
  }
95
92
  });
96
93
  }
94
+ const SPEC = { fork: { type: "boolean" }, copy: { type: "boolean" } };
97
95
  export const command = {
98
96
  summary: "print the command to continue or fork this session under another profile",
99
97
  usage: USAGE,
98
+ args: ["profile-or-auto"],
99
+ flags: flagsOf(SPEC),
100
100
  async run(args, io) {
101
- const target = args.find((a) => !a.startsWith("--"));
101
+ const p = parseFlags(args, SPEC, 1);
102
+ let target = p.positionals[0];
102
103
  if (!target) {
103
104
  const config = loadConfig(io.env);
104
- io.out(`profiles: ${[...listProfiles(config, io.env, "claude"), "auto"].join(" ")}`);
105
- io.out(`current: ${profileFromConfigDir(io.env.CLAUDE_CONFIG_DIR, config, io.env) ?? "(none)"}`);
106
- io.err(USAGE);
107
- return 2;
105
+ const current = profileFromConfigDir(io.env.CLAUDE_CONFIG_DIR, config, io.env);
106
+ if (!io.ask) {
107
+ // Scripts read these two lines; the error names the values and the exit is 2.
108
+ io.out(`profiles: ${[...listProfiles(config, io.env, "claude"), "auto"].join(" ")}`);
109
+ io.out(`current: ${current ?? "(none)"}`);
110
+ }
111
+ const { pickProfile } = await import("../picker.js");
112
+ target = await pickProfile(io, {
113
+ command: "session handoff",
114
+ title: bool(p, "fork") ? "Fork this session under" : "Continue this session under",
115
+ agent: "claude",
116
+ extra: ["auto"],
117
+ ...(current ? { marks: { [current]: "this session" } } : {}),
118
+ });
108
119
  }
109
- const h = buildHandoff(target, args.includes("--fork"), io.env);
120
+ const h = buildHandoff(target, bool(p, "fork"), io.env);
110
121
  for (const w of h.warnings)
111
122
  io.err(`warning: ${w}`);
112
123
  io.out(h.command);
113
- if (args.includes("--copy") && !(await copy(`${h.command}\n`)))
124
+ if (bool(p, "copy") && !(await copy(`${h.command}\n`)))
114
125
  io.err("warning: could not copy to the clipboard");
115
126
  return 0;
116
127
  },
@@ -1,107 +1,222 @@
1
+ import { effectivePolicy } from "../../accounts/policy.js";
1
2
  import { loadRegistry } from "../../accounts/registry.js";
2
3
  import { tildify } from "../../core/paths.js";
3
- import { JSON_FLAG, bool, parseFlags, printJson } from "../args.js";
4
+ import { DRY_RUN, JSON_FLAG, bool, flagsOf, parseFlags, str } from "../args.js";
5
+ import { emit, jsonOutput } from "../output.js";
4
6
  import { group } from "../group.js";
5
- import { fail, paint } from "../io.js";
7
+ import { launcherExists } from "../../accounts/delegate.js";
8
+ import { loadConfig } from "../../core/config.js";
9
+ import { fail } from "../io.js";
10
+ import { profileColor, style } from "../style.js";
6
11
  import * as accounts from "./accounts.js";
7
- import { dispatch, loadBrowser } from "./browser.js";
12
+ import { policyLine } from "./accounts.js";
13
+ import { NOT_INSTALLED, defaultDeps, dispatch } from "./browser.js";
14
+ import { SETTINGS_FLAGS, SETTINGS_FLAG_NAMES, SET_DETAILS, SET_FLAG_NAMES, SET_JSON, SET_SYNOPSIS, SHOW_JSON, } from "./browser-identity.js";
8
15
  /**
9
16
  * Who acts on an outside service for a session: a service account (`linear:work`, run by a
10
17
  * profile through the accounts bridge) or a browser identity (`browser:school`, a Chrome
11
18
  * profile with saved logins). One command for both; `accounts` and `browser` still work.
12
19
  */
13
20
  const BROWSER = "browser:";
21
+ let deps = defaultDeps;
14
22
  async function browserModule(io) {
15
- const mod = await loadBrowser();
23
+ const mod = await deps.load(io);
16
24
  if (!mod) {
17
- io.err("turno: the browser package (turno-browser) is not installed; browser identities need it");
18
- return fail("browser identities are not available");
25
+ io.err(`turno: ${NOT_INSTALLED}`);
26
+ return fail("browser identities need turno-browser");
19
27
  }
20
28
  return mod;
21
29
  }
22
- async function onBrowser(mod, sub, args, io) {
23
- try {
24
- return await dispatch(mod, sub, args, io);
25
- }
26
- catch (err) {
27
- if (err.name === "IdentityError")
28
- return fail(err.message);
29
- throw err;
30
- }
30
+ /** The first argument that is not a flag or a flag value, without parsing the flags. */
31
+ function firstId(args) {
32
+ return args.find((a) => !a.startsWith("-"));
31
33
  }
34
+ /** `turno identity list --json`. */
35
+ const LIST_JSON = jsonOutput(["services", "browser", "preferences"]);
32
36
  async function list(args, io) {
33
37
  const p = parseFlags(args, JSON_FLAG, 0);
34
38
  const reg = loadRegistry(io.env);
35
- const mod = await loadBrowser();
39
+ const mod = await deps.load(io);
36
40
  const browsers = mod ? mod.listIdentities(io.env) : [];
37
41
  if (bool(p, "json")) {
38
- printJson(io.out, {
42
+ emit(io, p, LIST_JSON, {
39
43
  services: Object.values(reg.accounts)
40
44
  .sort((a, b) => a.id.localeCompare(b.id))
41
- .map((a) => ({ id: a.id, service: a.service, profile: a.profile, tools: a.tools, description: a.description ?? null })),
45
+ .map((a) => ({
46
+ id: a.id,
47
+ service: a.service,
48
+ profile: a.profile,
49
+ tools: a.tools,
50
+ readTools: a.readTools ?? null,
51
+ confirm: effectivePolicy(a),
52
+ description: a.description ?? null,
53
+ })),
42
54
  browser: browsers.map((b) => ({ id: `${BROWSER}${b.id}`, inUse: b.inUse, dir: tildify(b.dir, io.env) })),
43
55
  preferences: reg.prefer.map((r) => ({ path: tildify(r.path, io.env), accounts: r.accounts })),
44
56
  });
45
57
  return 0;
46
58
  }
47
- io.out(paint(io, "Service accounts", "1"));
48
- accounts.list(io);
59
+ const st = style(io);
60
+ let colors = {};
61
+ try {
62
+ colors = loadConfig(io.env).profiles;
63
+ }
64
+ catch {
65
+ /* pills without their configured colors */
66
+ }
67
+ const pill = (name) => st.profile(name, profileColor(colors, name));
68
+ io.out(st.header("Service accounts"));
69
+ const services = Object.values(reg.accounts).sort((a, b) => a.id.localeCompare(b.id));
70
+ if (!services.length)
71
+ io.out(` none yet ${st.muted("(turno identity add linear:work --profile work --tools 'mcp__linear__*')")}`);
72
+ // Each account: id, profile, tools; under them its confirm policy and description.
73
+ const rows = st.tableRows(services.map((a) => [
74
+ st.bold(a.id),
75
+ pill(a.profile),
76
+ `${a.tools.join(", ")}${launcherExists(a.profile, io.env) ? "" : ` ${st.warn("(no launcher)")}`}`,
77
+ ]));
78
+ // Under the profile name: a pill on a terminal starts with a space of its own.
79
+ const under = " ".repeat(2 + Math.max(0, ...services.map((a) => a.id.length)) + 2 + (st.color ? 1 : 0));
80
+ services.forEach((a, i) => {
81
+ for (const l of rows[i])
82
+ io.out(l);
83
+ io.out(st.wrap(under, st.muted(policyLine(a))));
84
+ if (a.description)
85
+ io.out(st.wrap(under, st.muted(a.description)));
86
+ });
87
+ if (reg.prefer.length) {
88
+ io.out("");
89
+ io.out(st.header("Folder preferences"));
90
+ for (const l of st.table(reg.prefer.map((r) => [
91
+ tildify(r.path, io.env),
92
+ Object.entries(r.accounts)
93
+ .map(([sv, id]) => `${sv}=${id}`)
94
+ .join(" ") || st.muted("(none)"),
95
+ ])))
96
+ io.out(l);
97
+ }
49
98
  io.out("");
50
- io.out(paint(io, "Browser identities", "1"));
99
+ io.out(st.header("Browser identities"));
51
100
  if (!mod)
52
- io.out(" (the turno-browser package is not installed)");
101
+ io.out(st.note("warn", NOT_INSTALLED));
53
102
  else if (!browsers.length)
54
- io.out(" none yet (turno identity add browser:<id>)");
103
+ io.out(` none yet ${st.muted("(turno identity add browser:<id>)")}`);
55
104
  else {
56
- const w = Math.max(...browsers.map((b) => b.id.length)) + BROWSER.length;
57
- for (const b of browsers) {
58
- const state = b.inUse ? paint(io, "in use", "33") : paint(io, "free ", "32");
59
- io.out(` ${`${BROWSER}${b.id}`.padEnd(w)} ${state} ${tildify(b.dir, io.env)}`);
60
- }
105
+ const rows = browsers.map((b) => [
106
+ st.bold(`${BROWSER}${b.id}`),
107
+ b.inUse ? st.lead("on", st.warn("in use")) : st.lead("off", st.ok("free")),
108
+ st.muted(tildify(b.dir, io.env)),
109
+ ]);
110
+ for (const l of st.table(rows))
111
+ io.out(l);
61
112
  }
62
113
  return 0;
63
114
  }
115
+ /** `args` with its `browser:<id>` positional replaced by the bare id, for the browser command. */
116
+ function bareId(args) {
117
+ const at = args.findIndex((a) => !a.startsWith("-"));
118
+ return args.map((a, i) => (i === at ? a.slice(BROWSER.length) : a));
119
+ }
64
120
  async function add(args, io) {
65
- const id = args.find((a) => !a.startsWith("-"));
66
- if (id?.startsWith(BROWSER)) {
67
- if (args.includes("--dry-run")) {
68
- io.out(`(dry run) would create browser identity "${id.slice(BROWSER.length)}"`);
69
- return 0;
70
- }
71
- return onBrowser(await browserModule(io), "add", [id.slice(BROWSER.length)], io);
121
+ if (!firstId(args)?.startsWith(BROWSER))
122
+ return accounts.add(args, io);
123
+ const p = parseFlags(args, { ...DRY_RUN, ...SETTINGS_FLAGS }, 1);
124
+ const id = p.positionals[0].slice(BROWSER.length);
125
+ if (bool(p, "dry-run")) {
126
+ io.out(`(dry run) would create browser identity "${id}"`);
127
+ return 0;
72
128
  }
73
- return accounts.add(args, io);
129
+ return dispatch(await browserModule(io), "add", bareId(args), io, deps);
130
+ }
131
+ /** `show` and `set` exist for browser identities only. */
132
+ async function browserOnly(sub, args, io) {
133
+ const id = firstId(args);
134
+ if (!id?.startsWith(BROWSER))
135
+ return fail(`identity ${sub} works on browser identities (browser:<id>); service accounts are listed by \`turno identity list\``);
136
+ return dispatch(await browserModule(io), sub, bareId(args), io, deps);
74
137
  }
75
138
  async function remove(args, io) {
76
- const id = args.find((a) => !a.startsWith("-"));
77
- if (id?.startsWith(BROWSER)) {
78
- if (args.includes("--dry-run")) {
79
- io.out(`(dry run) would delete browser identity "${id.slice(BROWSER.length)}" and its saved logins`);
80
- return 0;
81
- }
82
- return onBrowser(await browserModule(io), "remove", [id.slice(BROWSER.length)], io);
139
+ if (!firstId(args)?.startsWith(BROWSER))
140
+ return accounts.remove(args, io);
141
+ const p = parseFlags(args, DRY_RUN, 1);
142
+ const id = p.positionals[0].slice(BROWSER.length);
143
+ if (bool(p, "dry-run")) {
144
+ io.out(`(dry run) would delete browser identity "${id}" and its saved logins`);
145
+ return 0;
83
146
  }
84
- return accounts.remove(args, io);
147
+ return dispatch(await browserModule(io), "remove", [id], io, deps);
85
148
  }
86
149
  async function login(args, io) {
87
- const [id, ...rest] = args;
150
+ const p = parseFlags(args, { url: { type: "string" } }, 1);
151
+ const id = p.positionals[0];
88
152
  if (!id)
89
153
  return fail("usage: turno identity login browser:<id> [--url <url>]");
90
154
  if (!id.startsWith(BROWSER))
91
- fail(`only browser identities sign in by hand; service accounts sign in through their profile (claude-<profile>)`);
92
- return onBrowser(await browserModule(io), "login", [id.slice(BROWSER.length), ...rest], io);
155
+ return fail("only browser identities sign in by hand; service accounts sign in through their profile (claude-<profile>)");
156
+ const url = str(p, "url");
157
+ return dispatch(await browserModule(io), "login", [id.slice(BROWSER.length), ...(url !== undefined ? ["--url", url] : [])], io, deps);
158
+ }
159
+ /** Swap the turno-browser loader and prompt, for tests. Returns the previous ones. */
160
+ export function setBrowserDeps(next) {
161
+ const prev = deps;
162
+ deps = next;
163
+ return prev;
93
164
  }
94
165
  export const command = group("identity", "who acts on outside services: service accounts (linear:work) and browser identities (browser:school)", {
95
- list: { summary: "service accounts, browser identities and folder preferences", synopsis: "[--json]", flags: ["--json"], run: list },
166
+ list: {
167
+ summary: "service accounts, browser identities and folder preferences",
168
+ synopsis: "[--json]",
169
+ flags: ["--json"],
170
+ json: LIST_JSON,
171
+ run: list,
172
+ },
96
173
  add: {
97
174
  summary: "add a service account, or create a browser identity (browser:<id>)",
98
- synopsis: "<service:label> --profile <p> --tools <pattern>[,...] | browser:<id> [--dry-run]",
175
+ synopsis: "<service:label> --profile <p> --tools <pattern>[,...] [--read-tools <pattern>[,...]] [--confirm always|writes|never] | browser:<id> [--timezone <zone>] [--languages <tag,...>] [--health-url <url> --health-text <text>] [--dry-run]",
99
176
  args: ["any"],
100
- flags: ["--profile", "--tools", "--service", "--description", "--dry-run"],
177
+ flags: [
178
+ "--profile",
179
+ "--tools",
180
+ "--read-tools",
181
+ "--confirm",
182
+ "--service",
183
+ "--description",
184
+ "--dry-run",
185
+ ...SETTINGS_FLAG_NAMES,
186
+ ],
101
187
  run: add,
102
188
  },
103
- remove: { summary: "remove a service account, or delete a browser identity and its logins", synopsis: "<id> [--dry-run]", args: ["identity"], flags: ["--dry-run"], run: remove },
104
- login: { summary: "open a browser identity's Chrome to sign in by hand once", synopsis: "browser:<id> [--url <url>]", args: ["identity"], flags: ["--url"], run: login },
189
+ show: {
190
+ summary: "a browser identity's settings, session health and who holds it",
191
+ synopsis: "browser:<id> [--json]",
192
+ args: ["identity"],
193
+ flags: ["--json"],
194
+ json: SHOW_JSON,
195
+ run: (a, io) => browserOnly("show", a, io),
196
+ },
197
+ set: {
198
+ summary: "change a browser identity's identity.json: place, languages, health check, tabs, blocking, cache",
199
+ synopsis: `browser:<id> ${SET_SYNOPSIS}`,
200
+ details: SET_DETAILS,
201
+ args: ["identity"],
202
+ flags: SET_FLAG_NAMES,
203
+ json: SET_JSON,
204
+ run: (a, io) => browserOnly("set", a, io),
205
+ },
206
+ remove: {
207
+ summary: "remove a service account, or delete a browser identity and its logins",
208
+ synopsis: "<id> [--dry-run]",
209
+ args: ["identity"],
210
+ flags: ["--dry-run"],
211
+ run: remove,
212
+ },
213
+ login: {
214
+ summary: "open a browser identity's Chrome to sign in by hand once",
215
+ synopsis: "browser:<id> [--url <url>]",
216
+ args: ["identity"],
217
+ flags: ["--url"],
218
+ run: login,
219
+ },
105
220
  prefer: {
106
221
  summary: "pick the account of a service for a folder (empty account removes it)",
107
222
  synopsis: "<dir> <service>=<account> [--dry-run]",
@@ -109,6 +224,29 @@ export const command = group("identity", "who acts on outside services: service
109
224
  flags: ["--dry-run"],
110
225
  run: async (a, io) => accounts.prefer(a, io),
111
226
  },
112
- log: { summary: "recent calls to the accounts bridge", synopsis: "[-n N]", flags: ["--tail"], run: async (a, io) => accounts.log(a, io) },
113
- }, { fallback: "list" });
227
+ log: {
228
+ summary: "recent calls to the accounts bridge; --verify checks the log's hash chain",
229
+ synopsis: "[-n N] [--verify] [--json]",
230
+ flags: flagsOf(accounts.LOG_SPEC),
231
+ json: accounts.LOG_JSON,
232
+ run: async (a, io) => accounts.log(a, io),
233
+ },
234
+ }, {
235
+ fallback: "list",
236
+ examples: [
237
+ "turno identity list",
238
+ "turno identity add linear:work --profile work --tools 'mcp__linear__*'",
239
+ "turno identity add browser:school",
240
+ "turno identity login browser:school",
241
+ "turno identity show browser:school",
242
+ "turno identity set browser:school --timezone Europe/Madrid --languages es-ES,es,en",
243
+ "turno identity set browser:school --tabs-max 5 --tabs-park 10m --background-throttling true",
244
+ "turno identity set browser:school --block-trackers true --block-types image,font --cache-max-size 200MB",
245
+ "turno identity set browser:school --settle 500ms --dry-run --json",
246
+ "turno identity set browser:school --no-block --no-cache",
247
+ "turno identity prefer ~/code/acme linear=linear:work",
248
+ "turno identity remove linear:work --dry-run",
249
+ "turno identity log --verify",
250
+ ],
251
+ });
114
252
  //# sourceMappingURL=identity.js.map