@lifesi/genesis-cli 0.1.3 → 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.
@@ -13,7 +13,7 @@ export async function closeHivesNodeTransport() {
13
13
  export function hivesOperationBudget(id) {
14
14
  if (['hives_list_buckets', 'hives_create_bucket', 'hives_get_bucket', 'hives_delete_bucket', 'hives_list_objects', 'hives_upload_object', 'hives_upload_object_by_key', 'hives_delete_object', 'hives_delete_object_by_key', 'hives_download_object_by_key', 'hives_get_cors_config', 'hives_set_cors_config', 'hives_generate_presigned_url', 'hives_reconcile'].includes(id))
15
15
  return 100_000;
16
- if (id === 'hives_cancel_deployment' || id === 'hives_delete_deployment')
16
+ if (id === 'hives_cancel_deployment' || id === 'hives_delete_deployment' || id === 'hives_stop_deployment')
17
17
  return 330_000;
18
18
  if (['hives_create_deployment', 'hives_upload_deployment', 'hives_invoke_deployment', 'hives_invoke_function', 'hives_invoke_function_async'].includes(id))
19
19
  return 40_000;
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.2')
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.2',
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);
@@ -77,6 +78,22 @@ export function buildProgram(deps = {}) {
77
78
  return s.organization_id;
78
79
  return (await gen.whoami()).org;
79
80
  };
81
+ const silos = program.command('silos').description('Serverless PostgreSQL');
82
+ const silosProjects = silos.command('projects').description('Projects in your verified organization');
83
+ silosProjects.command('list').action(async () => out.log(JSON.stringify(await (await client()).silos.projects.list(), null, 2)));
84
+ silosProjects.command('get <project_id>').action(async (id) => out.log(JSON.stringify(await (await client()).silos.projects.get(id), null, 2)));
85
+ silosProjects.command('create').requiredOption('--name <name>', 'Project name').requiredOption('--slug <slug>', 'Unique project slug')
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
+ }
80
97
  registerDials(program, { client, orgId, emit });
81
98
  // ---- auth ------------------------------------------------------------
82
99
  program.command('login').description('Sign in with LifeID in your browser').option('--no-browser', 'just print the link')
@@ -221,6 +238,8 @@ export function buildProgram(deps = {}) {
221
238
  .action(async (project, deployment, o) => emitDeployment(await (await hivesClient()).hives.deployments.rollback(project, deployment, { reason: o.reason })));
222
239
  deployments.command('cancel <project_id> <deployment_id>')
223
240
  .action(async (project, deployment) => emitDeployment(await (await hivesClient()).hives.deployments.cancel(project, deployment)));
241
+ deployments.command('stop <project_id> <deployment_id>').description('Stop the runtime; read its state before explicitly reconciling an uncertain result')
242
+ .action(async (project, deployment) => emitDeployment(await (await hivesClient()).hives.deployments.stop(project, deployment)));
224
243
  deployments.command('delete <project_id> <deployment_id>').description('Delete a deployment that is not currently active')
225
244
  .action(async (project, deployment) => { const result = await (await hivesClient()).hives.deployments.delete(project, deployment); emit(result, () => `Deleted deployment ${deployment}.`); });
226
245
  deployments.command('logs <project_id> <deployment_id>').description('Read real persisted deployment logs')
@@ -432,10 +451,19 @@ export function buildProgram(deps = {}) {
432
451
  });
433
452
  // ---- relays ----------------------------------------------------------
434
453
  const relays = program.command('relays').description('Relays: DNS zones and records');
454
+ registerRelaysEnrollment(relays, client, emit);
435
455
  relays.command('zones').description('List DNS zones').option('--search <q>').action(async (o) => {
436
456
  const r = await (await client()).relays.zones.list(o.search ? { search: o.search } : {});
437
457
  emit(r, () => table((r.zones ?? []), ['name', 'type', 'record_count', 'dnssec_enabled', 'status']));
438
458
  });
459
+ relays.command('zone <zone>').description('Read one DNS zone').action(async (zone) => {
460
+ const result = await (await client()).relays.zones.get(zone);
461
+ emit(result, () => JSON.stringify(result, null, 2));
462
+ });
463
+ relays.command('dnssec <zone>').description('Read DNSSEC status and authoritative key availability').action(async (zone) => {
464
+ const result = await (await client()).relays.zones.dnssec(zone);
465
+ emit(result, () => JSON.stringify(result, null, 2));
466
+ });
439
467
  const records = relays.command('records').description('DNS records in a zone');
440
468
  records.command('list <zone>', { isDefault: true }).option('--type <type>').action(async (zone, o) => {
441
469
  const r = await (await client()).relays.records.list(zone, o.type ? { type: o.type } : {});
@@ -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.3",
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.3"
21
+ "@lifesi/genesis": "0.1.5"
22
22
  },
23
23
  "optionalDependencies": {
24
24
  "@napi-rs/keyring": "^1.2.0"