@seekrit/cli 0.22.0 → 0.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1976,7 +1976,7 @@ function isServiceToken(value) {
1976
1976
  }
1977
1977
  //#endregion
1978
1978
  //#region package.json
1979
- var version = "0.22.0";
1979
+ var version = "0.23.1";
1980
1980
  //#endregion
1981
1981
  //#region ../../packages/api-client/src/index.ts
1982
1982
  var SeekritApiError = class extends Error {
@@ -4589,9 +4589,20 @@ program.command("run").description("run a command with decrypted secrets injecte
4589
4589
  ...process.env
4590
4590
  }
4591
4591
  });
4592
+ const signals = [
4593
+ "SIGINT",
4594
+ "SIGTERM",
4595
+ "SIGHUP",
4596
+ "SIGQUIT"
4597
+ ];
4598
+ const forward = (signal) => {
4599
+ if (child.exitCode === null && child.signalCode === null) child.kill(signal);
4600
+ };
4601
+ for (const signal of signals) process.on(signal, forward);
4592
4602
  child.on("exit", (code, signal) => {
4603
+ for (const s of signals) process.off(s, forward);
4593
4604
  if (signal) process.kill(process.pid, signal);
4594
- process.exit(code ?? 1);
4605
+ else process.exit(code ?? 1);
4595
4606
  });
4596
4607
  child.on("error", (err) => fail(`failed to start ${cmd}: ${err.message}`));
4597
4608
  });
@@ -4723,7 +4734,7 @@ registerMongoCommands(program);
4723
4734
  registerKmsCommands(program);
4724
4735
  registerRecoveryCommands(program);
4725
4736
  program.command("mcp").description("run an MCP server over stdio so AI agents can drive seekrit").action(async () => {
4726
- const { runMcpServer } = await import("./mcp-DScHFOMG.js");
4737
+ const { runMcpServer } = await import("./mcp-CbNXG37n.js");
4727
4738
  await runMcpServer();
4728
4739
  });
4729
4740
  program.command("audit").description("show the org audit trail").option("--org <slug>").option("--limit <n>", "entries to fetch", "50").action(async (options) => {
@@ -26,6 +26,74 @@ function errText(err) {
26
26
  isError: true
27
27
  };
28
28
  }
29
+ /**
30
+ * Short primer surfaced as the MCP server `instructions`. Most clients show
31
+ * this to the model on connect, so it has to orient an agent that lands here
32
+ * with zero context in a few lines.
33
+ */
34
+ function serverInstructions() {
35
+ return [
36
+ "seekrit is a zero-knowledge secrets manager. This is the LOCAL CRYPTO plane —",
37
+ "it runs on this machine, next to your key, so it's the one server that can",
38
+ "actually read or write a secret VALUE (everything else can only see structure).",
39
+ "",
40
+ "Auth comes from SEEKRIT_TOKEN (a skt_… token), SEEKRIT_CLIENT_ID +",
41
+ "SEEKRIT_CLIENT_SECRET (machine credentials — an admin token is minted and",
42
+ "cached automatically on first use), or the config saved by `seekrit login`.",
43
+ "Decrypting under a user session (not a token) additionally needs",
44
+ "SEEKRIT_PASSPHRASE set in this server's env — there's no TTY to prompt on.",
45
+ "",
46
+ "Model: org → apps/groups → environments → secrets. Call `whoami` first, then",
47
+ "`get_started` for the recommended end-to-end recipe. Prefer `run_command` over",
48
+ "`get_secret reveal:true` — it injects secrets into a subprocess so plaintext",
49
+ "never enters your context or the transcript."
50
+ ].join("\n");
51
+ }
52
+ /** The `get_started` tool body: the recommended first-project flow end to end. */
53
+ function getStartedText() {
54
+ return [
55
+ "# Standing up a project with seekrit (agent, end to end)",
56
+ "",
57
+ "This server is the crypto plane — every step below runs locally, next to your",
58
+ "key, so secret values never leave this machine.",
59
+ "",
60
+ "## 1. Confirm identity",
61
+ "`whoami` — see who you're authenticated as and which orgs you can reach. If it",
62
+ "fails, check SEEKRIT_TOKEN / SEEKRIT_CLIENT_ID+SEEKRIT_CLIENT_SECRET / saved",
63
+ "login in this server's env.",
64
+ "",
65
+ "## 2. Provision structure",
66
+ "- `create_org` (user session only — a service token can't own one) if you",
67
+ " don't have one yet, otherwise skip to the next step.",
68
+ "- `create_app` — an application to hold environments.",
69
+ "- `create_env` — generates the data key on this machine and grants it to you.",
70
+ "- `create_group` + `compose_group` (optional) — a reusable secret bag layered",
71
+ " under one or more app environments.",
72
+ "",
73
+ "## 3. Store secrets",
74
+ "- `set_secret` — encrypts a value locally and stores the ciphertext.",
75
+ "- `list_secrets` — confirm names + versions (never returns values).",
76
+ "",
77
+ "## 4. Use secrets without exposing them",
78
+ "- `run_command -- <cmd>` — inject secrets into a subprocess; prefer this.",
79
+ "- `export_env` — materialize a `.env` file when a tool needs one on disk.",
80
+ "- `get_secret reveal:true` — only when the value itself is what's needed.",
81
+ "",
82
+ "## 5. Propagate access",
83
+ "- `create_token` bound to an app+env — a runtime credential for CI/another",
84
+ " agent to decrypt with (pass `admin:true` instead for a provisioning token).",
85
+ "- `grant_env` — give another member or token access to an env's data key.",
86
+ "- `configure_project` — link a directory to an org/app (writes seekrit.json)",
87
+ " so a bound token can infer its target without flags.",
88
+ "",
89
+ "## 6. Verify",
90
+ "`audit` — every write, grant, and revocation is recorded; read it back.",
91
+ "",
92
+ "Also available: `kms_*` (client-side managed encrypt/sign keys) and",
93
+ "`create_pg_lease`/`create_mysql_lease` (short-lived database credentials whose",
94
+ "password is generated here and never stored anywhere in plaintext)."
95
+ ].join("\n");
96
+ }
29
97
  /** Build the client context or throw a friendly, agent-readable error. */
30
98
  function getCtx() {
31
99
  const ctx = tryBuildContext();
@@ -121,7 +189,7 @@ async function runMcpServer(options = {}) {
121
189
  const server = new McpServer({
122
190
  name: "seekrit",
123
191
  version: options.version ?? version
124
- });
192
+ }, { instructions: serverInstructions() });
125
193
  /** Register a tool whose handler returns data (serialized) or throws (→ isError). */
126
194
  const tool = (name, description, shape, handler) => {
127
195
  server.registerTool(name, {
@@ -135,6 +203,15 @@ async function runMcpServer(options = {}) {
135
203
  }
136
204
  }));
137
205
  };
206
+ server.registerTool("get_started", {
207
+ description: "The recommended first-project recipe: provision structure, store secrets, and use them without exposing values. Call this before doing anything else.",
208
+ inputSchema: {},
209
+ annotations: {
210
+ title: "get_started",
211
+ readOnlyHint: true,
212
+ openWorldHint: false
213
+ }
214
+ }, async () => jsonText(getStartedText()));
138
215
  tool("whoami", "Show the authenticated identity, its role, and accessible orgs.", {}, async () => {
139
216
  const ctx = getCtx();
140
217
  if (isTokenAuth(ctx) && ctx.auth.type === "bearer") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seekrit/cli",
3
- "version": "0.22.0",
3
+ "version": "0.23.1",
4
4
  "description": "End-to-end encrypted secrets manager CLI — inject decrypted secrets into any command.",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -27,8 +27,8 @@
27
27
  "@types/node": "^26.1.0",
28
28
  "tsdown": "^0.22.3",
29
29
  "@seekrit/api-client": "0.0.1",
30
- "@seekrit/core": "0.0.1",
31
- "@seekrit/crypto": "0.0.1"
30
+ "@seekrit/crypto": "0.0.1",
31
+ "@seekrit/core": "0.0.1"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "tsdown",