@lifesi/genesis-cli 0.1.4 → 0.1.5

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
@@ -1,3 +1,4 @@
1
+ import { registerRelaysEnrollment } from './relays-enrollment.js';
1
2
  import { registerBeacons } from './beacons.js';
2
3
  import { registerDials } from './dials.js';
3
4
  import { Command, CommanderError } from 'commander';
@@ -32,7 +33,7 @@ export function buildProgram(deps = {}) {
32
33
  const auth = { ...authConfig(env, f), sleep: deps.sleep };
33
34
  const program = new Command('genesis')
34
35
  .description('One CLI for every Genesis service.')
35
- .version('0.1.4')
36
+ .version('0.1.5')
36
37
  .option('--json', 'machine-readable JSON output')
37
38
  .option('--api-key <key>', 'use this API key (default: GENESIS_API_KEY, then your `genesis login`)')
38
39
  .option('--base-url <url>', 'gateway URL (default: GENESIS_BASE_URL or https://console.life.one/api)')
@@ -48,7 +49,7 @@ export function buildProgram(deps = {}) {
48
49
  const opts = {
49
50
  apiKey: o.apiKey ?? env.GENESIS_API_KEY, token: env.GENESIS_TOKEN,
50
51
  baseUrl: o.baseUrl ?? env.GENESIS_BASE_URL, routing: o.direct || env.GENESIS_ROUTING === 'direct' ? 'direct' : 'gateway',
51
- fetch: f, userAgent: 'genesis-cli/0.1.4',
52
+ fetch: f, userAgent: 'genesis-cli/0.1.5',
52
53
  credentials: store ? savedLoginProvider(auth, store) : undefined,
53
54
  };
54
55
  return new Genesis(hivesTransport ? { ...opts, fetch: createHivesNodeTransport(opts, deps.signal) } : opts);
@@ -83,6 +84,16 @@ export function buildProgram(deps = {}) {
83
84
  silosProjects.command('get <project_id>').action(async (id) => out.log(JSON.stringify(await (await client()).silos.projects.get(id), null, 2)));
84
85
  silosProjects.command('create').requiredOption('--name <name>', 'Project name').requiredOption('--slug <slug>', 'Unique project slug')
85
86
  .action(async (options) => out.log(JSON.stringify(await (await client()).silos.projects.create({ name: options.name, slug: options.slug }), null, 2)));
87
+ const owner = program.command('blinds').description('Blinds credential custody').command('owner-enrollment')
88
+ .description('Original-human enrollment only; preserve operation and locator IDs after unknown outcomes');
89
+ for (const [action, operation] of Object.entries({ reserve: 'blinds_ownerReserve', sign: 'blinds_ownerSign', attach: 'blinds_ownerAttach', 'p256-ensure': 'blinds_ownerP256Ensure' })) {
90
+ owner.command(action).requiredOption('--body-file <path>', 'Closed JSON request, up to 2 KiB; original human login required')
91
+ .action(async (options) => {
92
+ const body = await readFunctionJson(options.bodyFile, 2048);
93
+ const result = await (await client()).request(operation, { body }, { signal: deps.signal });
94
+ out.log(JSON.stringify(result, null, 2));
95
+ });
96
+ }
86
97
  registerDials(program, { client, orgId, emit });
87
98
  // ---- auth ------------------------------------------------------------
88
99
  program.command('login').description('Sign in with LifeID in your browser').option('--no-browser', 'just print the link')
@@ -440,6 +451,7 @@ export function buildProgram(deps = {}) {
440
451
  });
441
452
  // ---- relays ----------------------------------------------------------
442
453
  const relays = program.command('relays').description('Relays: DNS zones and records');
454
+ registerRelaysEnrollment(relays, client, emit);
443
455
  relays.command('zones').description('List DNS zones').option('--search <q>').action(async (o) => {
444
456
  const r = await (await client()).relays.zones.list(o.search ? { search: o.search } : {});
445
457
  emit(r, () => table((r.zones ?? []), ['name', 'type', 'record_count', 'dnssec_enabled', 'status']));
@@ -0,0 +1,3 @@
1
+ import type { Command } from 'commander';
2
+ import type { Genesis } from '@lifesi/genesis';
3
+ export declare function registerRelaysEnrollment(relays: Command, client: () => Promise<Genesis>, emit: (value: unknown, pretty: () => string) => void): void;
@@ -0,0 +1,7 @@
1
+ export function registerRelaysEnrollment(relays, client, emit) {
2
+ const enrollment = relays.command('enrollment').description('Explicit empty Relays account for the current verified human selection');
3
+ for (const action of ['get', 'activate'])
4
+ enrollment.command(action).allowExcessArguments(false)
5
+ .description(action === 'get' ? 'Read status without creating an account' : 'Activate once; read status after any unconfirmed response')
6
+ .action(async () => { const value = await (await client()).relays.enrollment[action](); emit(value, () => JSON.stringify(value, null, 2)); });
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifesi/genesis-cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/l1felabs/genesis-api.git",
@@ -18,7 +18,7 @@
18
18
  "dependencies": {
19
19
  "commander": "^14.0.0",
20
20
  "undici": "6.29.0",
21
- "@lifesi/genesis": "0.1.4"
21
+ "@lifesi/genesis": "0.1.5"
22
22
  },
23
23
  "optionalDependencies": {
24
24
  "@napi-rs/keyring": "^1.2.0"