nostr-bray 1.29.0 → 1.29.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.
Files changed (2) hide show
  1. package/dist/cli.js +11 -14
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -23,6 +23,16 @@ import { handleKeyEncrypt, handleKeyDecrypt } from './util/ncryptsec.js';
23
23
  import { getCommandHelp } from './help.js';
24
24
  import * as fmt from './format.js';
25
25
  const args = process.argv.slice(2);
26
+ // Strip global flags before command detection so `--bunker <uri> whoami` works.
27
+ // Inject into env so loadConfig() picks them up via its normal path.
28
+ for (const flag of ['--bunker', '--key']) {
29
+ const i = args.indexOf(flag);
30
+ if (i !== -1) {
31
+ const envKey = flag === '--bunker' ? 'BUNKER_URI' : 'NOSTR_SECRET_KEY';
32
+ process.env[envKey] = args[i + 1];
33
+ args.splice(i, 2);
34
+ }
35
+ }
26
36
  const command = args[0];
27
37
  // No command = start MCP server.
28
38
  //
@@ -237,20 +247,6 @@ if (command === 'help' || command === '--help' || command === '-h') {
237
247
  console.log(HELP);
238
248
  process.exit(0);
239
249
  }
240
- // Allow key/bunker overrides on the command line
241
- // These are injected into env before loadConfig() so all loading logic stays centralised.
242
- // Note: loadConfig() deletes BUNKER_URI / NOSTR_SECRET_KEY from env after reading them.
243
- if (args.includes('--bunker')) {
244
- process.env.BUNKER_URI = args[args.indexOf('--bunker') + 1];
245
- // Remove from args so commands don't see it as a positional argument
246
- const i = args.indexOf('--bunker');
247
- args.splice(i, 2);
248
- }
249
- if (args.includes('--key')) {
250
- process.env.NOSTR_SECRET_KEY = args[args.indexOf('--key') + 1];
251
- const i = args.indexOf('--key');
252
- args.splice(i, 2);
253
- }
254
250
  // Commands that work purely offline — no relay connection needed
255
251
  const OFFLINE_COMMANDS = new Set([
256
252
  'whoami', 'create', 'list', 'derive', 'persona', 'switch', 'prove',
@@ -271,6 +267,7 @@ let ctx;
271
267
  if (config.bunkerUri) {
272
268
  const { BunkerContext } = await import('./bunker-context.js');
273
269
  ctx = await BunkerContext.connect(config.bunkerUri);
270
+ await ctx.resolvePublicKey();
274
271
  console.error(`Connected to bunker — signing as ${ctx.activeNpub}`);
275
272
  }
276
273
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nostr-bray",
3
- "version": "1.29.0",
3
+ "version": "1.29.1",
4
4
  "mcpName": "dev.forgesworn/bray",
5
5
  "description": "Trust-aware Nostr for AI and humans. Three dimensions of trust -- verification, proximity, and access -- woven into every interaction.",
6
6
  "type": "module",