@geslar/cli 0.3.0 → 0.3.2

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/README.md CHANGED
@@ -15,11 +15,12 @@ The server never sees which vault, item, or field a reference asks for — resol
15
15
  `geslar mcp serve` runs a stdio [MCP](https://modelcontextprotocol.io) server for Claude Code, Claude Desktop, Cursor, and other MCP clients — 6 tools (list vaults/items, whoami, provision-env, run, recent audit) scoped to an [agent profile](https://docs.geslar.app/cli/reference#agent-profiles), gated behind an out-of-band pre-grant (`geslar mcp allow`/`allow-cmd`) for anything that writes or executes. No tool returns a secret value — `run` reports only exit status and line counts, and by default returns no process output at all.
16
16
 
17
17
  ```sh
18
+ geslar unlock --ttl 30m
18
19
  geslar agent create my-agent --vault Work
19
20
  geslar mcp init my-agent --client claude-code
20
21
  ```
21
22
 
22
- `geslar mcp init` detects your MCP client and wires up the config for you (version-pinned, never `@latest`, never contains a token). Full reference — all 6 tools, the pre-grant model, and known limitations — at [docs.geslar.app/cli/reference](https://docs.geslar.app/cli/reference).
23
+ `geslar mcp init` detects your MCP client and wires up the config for you (never contains a token). It points the config at your globally-installed `geslar` if one is on your PATH (tracking whatever version that is), otherwise at a version-pinned `npx -y @geslar/cli@<version>` — never an unpinned `@latest`. Full reference — all 6 tools, the pre-grant model, and known limitations — at [docs.geslar.app/cli/reference](https://docs.geslar.app/cli/reference).
23
24
 
24
25
  Full docs: install (including standalone Windows/Linux binaries), quickstart, the `geslar://` reference syntax, agent profiles, and known limitations — see [docs.geslar.app/cli/reference](https://docs.geslar.app/cli/reference) or the `docs/cli/` directory in the [geslar-suite](https://github.com/StudioIT/geslar-suite) repository.
25
26
 
package/dist/index.js CHANGED
@@ -608,7 +608,7 @@ var init_signin = __esm({
608
608
  init_errors();
609
609
  init_token_store();
610
610
  init_device_flow();
611
- CLI_VERSION = "0.3.0";
611
+ CLI_VERSION = "0.3.2";
612
612
  }
613
613
  });
614
614
 
@@ -26584,6 +26584,14 @@ import { execFileSync } from "node:child_process";
26584
26584
  import { createInterface as createInterface2 } from "node:readline/promises";
26585
26585
  var MCP_SERVER_NAME = "geslar";
26586
26586
  var KNOWN_CLIENTS = ["claude-code", "claude-desktop", "cursor", "json"];
26587
+ var KNOWN_CLAUDE_SCOPES = ["user", "local"];
26588
+ function normalizeClaudeScope(raw) {
26589
+ if (raw === void 0) return "user";
26590
+ if (!KNOWN_CLAUDE_SCOPES.includes(raw)) {
26591
+ throw new CliError(EXIT.GENERAL, `Unknown --scope "${raw}" \u2014 expected one of: ${KNOWN_CLAUDE_SCOPES.join(", ")}`);
26592
+ }
26593
+ return raw;
26594
+ }
26587
26595
  function findOnPath(names) {
26588
26596
  const pathEnv = process.env["PATH"] ?? process.env["Path"] ?? "";
26589
26597
  for (const dir of pathEnv.split(delimiter)) {
@@ -26755,12 +26763,12 @@ function printNextSteps() {
26755
26763
  print(' geslar mcp allow-cmd "npm test" --ttl 8h');
26756
26764
  print("Reminder: this narrows ACCIDENTAL scope only \u2014 it is not a security boundary against an injected agent. Keep patterns as narrow as your workflow allows.");
26757
26765
  }
26758
- async function handleClaudeCode(entry) {
26766
+ async function handleClaudeCode(entry, scope) {
26759
26767
  const claudeBin = findClaudeCliOnPath();
26760
26768
  if (claudeBin) {
26761
26769
  try {
26762
- execFileSync(claudeBin, ["mcp", "add-json", MCP_SERVER_NAME, JSON.stringify(entry)], { stdio: "inherit" });
26763
- print(`Registered "${MCP_SERVER_NAME}" with the Claude Code CLI.`);
26770
+ execFileSync(claudeBin, ["mcp", "add-json", MCP_SERVER_NAME, JSON.stringify(entry), "--scope", scope], { stdio: "inherit" });
26771
+ print(`Registered "${MCP_SERVER_NAME}" with the Claude Code CLI (${scope} scope).`);
26764
26772
  return;
26765
26773
  } catch (err) {
26766
26774
  printErr(`\`claude mcp add-json\` failed (${err.message}) \u2014 falling back to hand-editing .mcp.json`);
@@ -26780,7 +26788,7 @@ async function mcpInitCommand(agentName, opts) {
26780
26788
  printJsonSnippet(entry);
26781
26789
  break;
26782
26790
  case "claude-code":
26783
- await handleClaudeCode(entry);
26791
+ await handleClaudeCode(entry, normalizeClaudeScope(opts.claudeScope));
26784
26792
  break;
26785
26793
  case "claude-desktop": {
26786
26794
  const { path, unconfirmed } = claudeDesktopConfigPath(opts.platformOverride);
@@ -26875,8 +26883,8 @@ mcp.command("grants").description("List active MCP pre-grants").action(async ()
26875
26883
  mcp.command("revoke").argument("[id]", "grant id to revoke").option("--all", "revoke every active grant").action(async (id, opts) => {
26876
26884
  process.exitCode = await mcpRevokeCommand(id, opts);
26877
26885
  });
26878
- mcp.command("init").argument("<agent>", "existing agent profile name to embed in the generated MCP server config (see `geslar agent create`)").option("--client <client>", "claude-code | claude-desktop | cursor | json (default: auto-detect, else json if non-interactive/ambiguous)").description("Onboard an MCP client (Claude Code, Claude Desktop, Cursor) to run `geslar mcp serve` for an agent profile (spec-mcp.md \xA73)").action(async (agent2, opts) => {
26879
- process.exitCode = await mcpInitCommand(agent2, opts);
26886
+ mcp.command("init").argument("<agent>", "existing agent profile name to embed in the generated MCP server config (see `geslar agent create`)").option("--client <client>", "claude-code | claude-desktop | cursor | json (default: auto-detect, else json if non-interactive/ambiguous)").option("--scope <scope>", "Claude Code only: user | local (default: user \u2014 available in every project, not just the one mcp init was run from)").description("Onboard an MCP client (Claude Code, Claude Desktop, Cursor) to run `geslar mcp serve` for an agent profile (spec-mcp.md \xA73)").action(async (agent2, opts) => {
26887
+ process.exitCode = await mcpInitCommand(agent2, { client: opts.client, claudeScope: opts.scope });
26880
26888
  });
26881
26889
  mcp.command("serve").description("Start the MCP stdio server (spec-mcp.md)").option("--allow-shell", "invoke commands through a shell instead of raw argv (operator opt-in only)").option("--return-stdout-tail", "return a scrubbed tail of child stdout/stderr (lowers guarantees \u2014 spec-mcp \xA72.5)").option("--root <dir>", "server root for path-fenced tools (default: launch cwd)").option("--pass-env <vars>", "comma-separated ambient env var NAMES to allowlist through to geslar_run's child process, e.g. HTTPS_PROXY,NODE_EXTRA_CA_CERTS (operator opt-in only \u2014 spec-mcp \xA72.1)").action(async (opts) => {
26882
26890
  const { mcpServeCommand: mcpServeCommand2 } = await Promise.resolve().then(() => (init_mcp_serve(), mcp_serve_exports));