@namera-ai/cli 0.1.2 → 0.1.3

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
@@ -51,10 +51,12 @@ Build from source:
51
51
  ```bash
52
52
  gh repo clone thenamespace/namera
53
53
  cd namera
54
- bun install
54
+ pnpm install
55
55
  cd apps/cli
56
- bun run build
57
- bun run start -- --help
56
+ pnpm run build
57
+ pnpm run start -- --help
58
+ # or link to global install
59
+ pnpm link
58
60
  ```
59
61
 
60
62
  ## Quick Start
@@ -141,7 +143,7 @@ namera session-key create --params '{"alias":"my-session-key","smartAccountAlias
141
143
  All commands support global output flags:
142
144
 
143
145
  - `--output`, `-o`: `pretty` (default), `json`, or `ndjson`
144
- - `--quite`, `-q`: Suppress output entirely
146
+ - `--quiet`, `-q`: Suppress output entirely
145
147
 
146
148
  ```bash
147
149
  namera smart-account list --output json
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import "dotenv/config";
3
3
  import { NodeHttpServer, NodeRuntime, NodeServices, NodeStdio } from "@effect/platform-node";
4
4
  import { Config, ConfigProvider, Console, Data, Duration, Effect, FileSystem, Layer, Logger, Option, Path, Redacted, Schema, SchemaTransformation, ServiceMap, Struct } from "effect";
5
- import { Argument, Command, Flag, GlobalFlag, Prompt } from "effect/unstable/cli";
5
+ import { Argument, CliError, Command, Flag, GlobalFlag, Prompt } from "effect/unstable/cli";
6
6
  import { arbitrum, arbitrumSepolia, arcTestnet, avalanche, avalancheFuji, base, baseSepolia, celo, celoSepolia, mainnet, monad, monadTestnet, optimism, optimismSepolia, polygon, polygonAmoy, scroll, scrollSepolia, sepolia, tempoModerato, unichain, unichainSepolia, zora, zoraSepolia } from "viem/chains";
7
7
  import os from "node:os";
8
8
  import { Wallet } from "@ethereumjs/wallet";
@@ -401,20 +401,20 @@ const globalOutput = GlobalFlag.setting("output")({ flag: Flag.choice("output",
401
401
  "json",
402
402
  "ndjson"
403
403
  ]).pipe(Flag.withAlias("o"), Flag.withDefault("pretty"), Flag.withDescription("Output format (pretty, json, ndjson)")) });
404
- const globalQuite = GlobalFlag.setting("quite")({ flag: Flag.boolean("quite").pipe(Flag.withAlias("q"), Flag.withDefault(false), Flag.withDescription("Do not print output")) });
404
+ const globalQuiet = GlobalFlag.setting("quiet")({ flag: Flag.boolean("quiet").pipe(Flag.withAlias("q"), Flag.withDefault(false), Flag.withDescription("Do not print output")) });
405
405
  const globalParams = GlobalFlag.setting("params")({ flag: Flag.string("params").pipe(Flag.optional, Flag.withDescription("JSON Parameters to pass to the command")) });
406
406
  const getGlobalFlags = () => Effect.gen(function* () {
407
407
  const out = yield* globalOutput;
408
- const quite = yield* globalQuite;
408
+ const quiet = yield* globalQuiet;
409
409
  return {
410
410
  out,
411
411
  params: yield* globalParams,
412
- quite
412
+ quiet
413
413
  };
414
414
  });
415
415
  const globalFlags = [
416
416
  globalOutput,
417
- globalQuite,
417
+ globalQuiet,
418
418
  globalParams
419
419
  ];
420
420
  //#endregion
@@ -1824,7 +1824,7 @@ const createKeystoreHandler = (flagAlias, flagPassword) => Effect.gen(function*
1824
1824
  alias: res.alias,
1825
1825
  path: res.path
1826
1826
  };
1827
- if (globalFlags.quite) return;
1827
+ if (globalFlags.quiet) return;
1828
1828
  const output = yield* outputFormatter.format(data, globalFlags.out);
1829
1829
  yield* Console.log(output);
1830
1830
  });
@@ -1882,7 +1882,7 @@ const handler$14 = (flagAlias, flagPassword) => Effect.gen(function* () {
1882
1882
  publicKey: res.publicKey,
1883
1883
  privateKey: Redacted.value(res.privateKey)
1884
1884
  };
1885
- if (globalFlags.quite) return;
1885
+ if (globalFlags.quiet) return;
1886
1886
  const output = yield* outputFormatter.format(data, globalFlags.out);
1887
1887
  yield* Console.log(output);
1888
1888
  });
@@ -1951,7 +1951,7 @@ const handler$13 = (flagAlias, flagPassword, flagPrivateKey) => Effect.gen(funct
1951
1951
  address: res.data.address,
1952
1952
  path: res.path
1953
1953
  };
1954
- if (globalFlags.quite) return;
1954
+ if (globalFlags.quiet) return;
1955
1955
  const output = yield* outputFormatter.format(data, globalFlags.out);
1956
1956
  yield* Console.log(output);
1957
1957
  });
@@ -2003,7 +2003,7 @@ const getKeystoreInfoHandler = (flagAlias) => Effect.gen(function* () {
2003
2003
  address: res.data.address,
2004
2004
  path: res.path
2005
2005
  };
2006
- if (globalFlags.quite) return;
2006
+ if (globalFlags.quiet) return;
2007
2007
  const output = yield* outputFormatter.format(data, globalFlags.out);
2008
2008
  yield* Console.log(output);
2009
2009
  });
@@ -2044,7 +2044,7 @@ const listKeystoreHandler = () => Effect.gen(function* () {
2044
2044
  address: k.data.address,
2045
2045
  path: k.path
2046
2046
  }));
2047
- if (globalFlags.quite) return;
2047
+ if (globalFlags.quiet) return;
2048
2048
  const output = yield* outputFormatter.format(data, globalFlags.out);
2049
2049
  yield* Console.log(output);
2050
2050
  });
@@ -2085,7 +2085,7 @@ const handler$12 = (flagAlias) => Effect.gen(function* () {
2085
2085
  }
2086
2086
  yield* keystoreManager.removeKeystore(params);
2087
2087
  const data = { success: true };
2088
- if (globalFlags.quite) return;
2088
+ if (globalFlags.quiet) return;
2089
2089
  const output = yield* outputFormatter.format(data, globalFlags.out);
2090
2090
  yield* Console.log(output);
2091
2091
  });
@@ -2113,7 +2113,10 @@ const removeKeystoreCommand = Command.make("remove", { alias: alias$8 }, ({ alia
2113
2113
  /**
2114
2114
  * Command group for keystore-related operations.
2115
2115
  */
2116
- const keystoreCommands = Command.make("keystore", {}, () => Effect.void).pipe(Command.withDescription("Keystore management utilities."), Command.withAlias("k"), Command.withSubcommands([
2116
+ const keystoreCommands = Command.make("keystore", {}, () => Effect.fail(new CliError.ShowHelp({
2117
+ commandPath: ["namera", "keystore"],
2118
+ errors: []
2119
+ }))).pipe(Command.withDescription("Keystore management utilities."), Command.withAlias("k"), Command.withSubcommands([
2117
2120
  createKeystoreCommand,
2118
2121
  listKeystoresCommand,
2119
2122
  getKeystoreInfoCommand,
@@ -2193,7 +2196,10 @@ const startMcpCommand = Command.make("start", {
2193
2196
  ]));
2194
2197
  //#endregion
2195
2198
  //#region src/commands/mcp/index.ts
2196
- const mcpCommands = Command.make("mcp", {}, () => Effect.void).pipe(Command.withDescription("Start and manage the Namera MCP server"), Command.withSubcommands([startMcpCommand]));
2199
+ const mcpCommands = Command.make("mcp", {}, () => Effect.fail(new CliError.ShowHelp({
2200
+ commandPath: ["namera", "mcp"],
2201
+ errors: []
2202
+ }))).pipe(Command.withDescription("Start and manage the Namera MCP server"), Command.withSubcommands([startMcpCommand]));
2197
2203
  //#endregion
2198
2204
  //#region src/helpers/paths.ts
2199
2205
  /** biome-ignore-all lint/suspicious/noExplicitAny: safe */
@@ -2570,7 +2576,7 @@ const handler$10 = (flagAlias, flagSmartAccountAlias, flagSessionKeyPassword, fl
2570
2576
  smartAccount: res.data.smartAccountAlias,
2571
2577
  chains: res.data.serializedAccounts.map((a) => getChain(a.chain).name)
2572
2578
  };
2573
- if (globalFlags.quite) return;
2579
+ if (globalFlags.quiet) return;
2574
2580
  const output = yield* outputFormatter.format(data, globalFlags.out);
2575
2581
  yield* Console.log(output);
2576
2582
  });
@@ -2761,7 +2767,7 @@ const handler$9 = (flagAlias) => Effect.gen(function* () {
2761
2767
  chains: res.data.serializedAccounts.map((a) => getChain(a.chain).name).join(", "),
2762
2768
  policies: humanizePolicyParams(res.data.serializedAccounts[0]?.serializedAccount ?? "")
2763
2769
  };
2764
- if (globalFlags.quite) return;
2770
+ if (globalFlags.quiet) return;
2765
2771
  const output = yield* outputFormatter.format(data, globalFlags.out);
2766
2772
  yield* Console.log(output);
2767
2773
  });
@@ -2800,7 +2806,7 @@ const handler$8 = (flagSmartAccountAlias) => Effect.gen(function* () {
2800
2806
  smartAccount: d.data.smartAccountAlias,
2801
2807
  chains: d.data.serializedAccounts.map((a) => getChain(a.chain).name).join(", ")
2802
2808
  }));
2803
- if (globalFlags.quite) return;
2809
+ if (globalFlags.quiet) return;
2804
2810
  const output = yield* outputFormatter.format(data, globalFlags.out);
2805
2811
  yield* Console.log(output);
2806
2812
  });
@@ -2846,7 +2852,7 @@ const handler$7 = (flagAlias) => Effect.gen(function* () {
2846
2852
  }
2847
2853
  yield* sessionKeyManager.removeSessionKey(params);
2848
2854
  const data = { success: true };
2849
- if (globalFlags.quite) return;
2855
+ if (globalFlags.quiet) return;
2850
2856
  const output = yield* outputFormatter.format(data, globalFlags.out);
2851
2857
  yield* Console.log(output);
2852
2858
  });
@@ -2897,7 +2903,7 @@ const handler$6 = (flagAlias, flagChain, flagRpcUrl) => Effect.gen(function* ()
2897
2903
  };
2898
2904
  }
2899
2905
  const data = { installed: yield* sessionKeyManager.getSessionKeyStatus(params) };
2900
- if (globalFlags.quite) return;
2906
+ if (globalFlags.quiet) return;
2901
2907
  const output = yield* outputFormatter.format(data, globalFlags.out);
2902
2908
  yield* Console.log(output);
2903
2909
  });
@@ -2928,7 +2934,10 @@ const getSessionKeyStatusCommand = Command.make("status", {
2928
2934
  /**
2929
2935
  * Command group for session-key related operations.
2930
2936
  */
2931
- const sessionKeyCommands = Command.make("session-key", {}, () => Effect.void).pipe(Command.withAlias("sk"), Command.withDescription("Session Key management commands."), Command.withSubcommands([
2937
+ const sessionKeyCommands = Command.make("session-key", {}, () => Effect.fail(new CliError.ShowHelp({
2938
+ commandPath: ["namera", "session-key"],
2939
+ errors: []
2940
+ }))).pipe(Command.withAlias("sk"), Command.withDescription("Session Key management commands."), Command.withSubcommands([
2932
2941
  createSessionKeyCommand,
2933
2942
  listSessionKeysCommand,
2934
2943
  getSessionKeyInfoCommand,
@@ -2979,7 +2988,7 @@ const handler$5 = (flagAlias, flagOwnerAlias, flagOwnerPassword, flagIndex) => E
2979
2988
  index: Number(res.data.index),
2980
2989
  owner: res.data.ownerAlias
2981
2990
  };
2982
- if (globalFlags.quite) return;
2991
+ if (globalFlags.quiet) return;
2983
2992
  const output = yield* outputFormatter.format(data, globalFlags.out);
2984
2993
  yield* Console.log(output);
2985
2994
  });
@@ -3034,7 +3043,7 @@ const handler$4 = () => Effect.gen(function* () {
3034
3043
  index: Number(res.data.index),
3035
3044
  kernelVersion: res.data.kernelVersion
3036
3045
  };
3037
- if (globalFlags.quite) return;
3046
+ if (globalFlags.quiet) return;
3038
3047
  const output = yield* outputFormatter.format(data, globalFlags.out);
3039
3048
  yield* Console.log(output);
3040
3049
  });
@@ -3070,7 +3079,7 @@ const handler$3 = (flagAlias) => Effect.gen(function* () {
3070
3079
  index: Number(res.data.index),
3071
3080
  kernelVersion: res.data.kernelVersion
3072
3081
  };
3073
- if (globalFlags.quite) return;
3082
+ if (globalFlags.quiet) return;
3074
3083
  const output = yield* outputFormatter.format(data, globalFlags.out);
3075
3084
  yield* Console.log(output);
3076
3085
  });
@@ -3115,7 +3124,7 @@ const handler$2 = () => Effect.gen(function* () {
3115
3124
  index: Number(d.data.index),
3116
3125
  kernelVersion: d.data.kernelVersion
3117
3126
  }));
3118
- if (globalFlags.quite) return;
3127
+ if (globalFlags.quiet) return;
3119
3128
  const output = yield* outputFormatter.format(data, globalFlags.out);
3120
3129
  yield* Console.log(output);
3121
3130
  });
@@ -3156,7 +3165,7 @@ const handler$1 = (flagAlias) => Effect.gen(function* () {
3156
3165
  }
3157
3166
  yield* smartAccountManager.removeSmartAccount(params);
3158
3167
  const data = { success: true };
3159
- if (globalFlags.quite) return;
3168
+ if (globalFlags.quiet) return;
3160
3169
  const output = yield* outputFormatter.format(data, globalFlags.out);
3161
3170
  yield* Console.log(output);
3162
3171
  });
@@ -3206,7 +3215,7 @@ const handler = (flagAlias, flagChain, flagRpcUrl) => Effect.gen(function* () {
3206
3215
  };
3207
3216
  }
3208
3217
  const data = { deployed: yield* smartAccountManager.getSmartAccountStatus(params) };
3209
- if (globalFlags.quite) return;
3218
+ if (globalFlags.quiet) return;
3210
3219
  const output = yield* outputFormatter.format(data, globalFlags.out);
3211
3220
  yield* Console.log(output);
3212
3221
  });
@@ -3238,7 +3247,10 @@ const getSmartAccountStatus = Command.make("status", {
3238
3247
  */
3239
3248
  const commands = [
3240
3249
  keystoreCommands,
3241
- Command.make("smart-account", {}, () => Effect.void).pipe(Command.withAlias("sa"), Command.withDescription("Smart Account management utilities."), Command.withSubcommands([
3250
+ Command.make("smart-account", {}, () => Effect.fail(new CliError.ShowHelp({
3251
+ commandPath: ["namera", "smart-account"],
3252
+ errors: []
3253
+ }))).pipe(Command.withAlias("sa"), Command.withDescription("Smart Account management utilities."), Command.withSubcommands([
3242
3254
  createSmartAccountCommand,
3243
3255
  listSmartAccountsCommand,
3244
3256
  getSmartAccountInfoCommand,
@@ -3252,7 +3264,10 @@ const commands = [
3252
3264
  ];
3253
3265
  //#endregion
3254
3266
  //#region src/index.ts
3255
- const command = Command.make("namera", {}, () => Effect.void).pipe(Command.withDescription("Programmable Session keys for Smart Contracts Accounts."), Command.withGlobalFlags(globalFlags), Command.withSubcommands(commands), Command.withExamples([{
3267
+ const command = Command.make("namera", {}, () => Effect.fail(new CliError.ShowHelp({
3268
+ commandPath: ["namera"],
3269
+ errors: []
3270
+ }))).pipe(Command.withDescription("Programmable Session keys for Smart Contracts Accounts."), Command.withGlobalFlags(globalFlags), Command.withSubcommands(commands), Command.withExamples([{
3256
3271
  command: "namera --help",
3257
3272
  description: "Print help"
3258
3273
  }, {
@@ -3263,7 +3278,7 @@ const Layers = layer$1.pipe(Layer.provideMerge(layer$2), Layer.provideMerge(laye
3263
3278
  Effect.gen(function* () {
3264
3279
  yield* (yield* ConfigManager).ensureConfigDirExists();
3265
3280
  yield* Command.run(command, { version: "0.0.1" });
3266
- }).pipe(Effect.provide(Layers), Effect.provideService(ConfigProvider.ConfigProvider, ConfigProvider.fromEnv()), Effect.catch((e) => Console.error(e.message))).pipe(NodeRuntime.runMain);
3281
+ }).pipe(Effect.provide(Layers), Effect.provideService(ConfigProvider.ConfigProvider, ConfigProvider.fromEnv()), Effect.catchTag("ShowHelp", () => Effect.succeed(void 0)), Effect.catch((e) => Console.error(e.message))).pipe(NodeRuntime.runMain);
3267
3282
  //#endregion
3268
3283
  export {};
3269
3284