From 5c8ba0b850c121f0571ebb4410acdcb6414c4202 Mon Sep 17 00:00:00 2001 From: Lee <6251863+ltyu@users.noreply.github.com> Date: Wed, 19 Jun 2024 16:51:17 -0400 Subject: [PATCH] fix(cli): Rename `hyperlane config create chain` -> `hyperlane registry init` (#3978) ### Description Renames `hyperlane config create chain` -> `hyperlane registry init` as according to https://www.notion.so/hyperlanexyz/Must-use-config-to-create-a-new-chain-instead-of-the-registry-command-f7b407b29a834f7288f20e4c08bc206e?pvs=4 ### Drive-by changes - Rename `configure` to `init` for all functions - Reorder functions alphabetically ### Backward compatibility No ### Testing Manual --- .changeset/giant-lies-whisper.md | 5 +++++ typescript/cli/src/commands/config.ts | 28 ++----------------------- typescript/cli/src/commands/core.ts | 6 +++--- typescript/cli/src/commands/registry.ts | 15 +++++++++++-- typescript/cli/src/commands/warp.ts | 6 +++--- 5 files changed, 26 insertions(+), 34 deletions(-) create mode 100644 .changeset/giant-lies-whisper.md diff --git a/.changeset/giant-lies-whisper.md b/.changeset/giant-lies-whisper.md new file mode 100644 index 000000000..374acdf49 --- /dev/null +++ b/.changeset/giant-lies-whisper.md @@ -0,0 +1,5 @@ +--- +'@hyperlane-xyz/cli': minor +--- + +Rename hyperlane config create chain -> hyperlane registry init. Rename all `configure` to `init` diff --git a/typescript/cli/src/commands/config.ts b/typescript/cli/src/commands/config.ts index 2dd532249..7b145ca44 100644 --- a/typescript/cli/src/commands/config.ts +++ b/typescript/cli/src/commands/config.ts @@ -1,6 +1,6 @@ import { CommandModule } from 'yargs'; -import { createChainConfig, readChainConfigs } from '../config/chain.js'; +import { readChainConfigs } from '../config/chain.js'; import { readIsmConfig } from '../config/ism.js'; import { readMultisigConfig } from '../config/multisig.js'; import { readWarpRouteDeployConfig } from '../config/warp.js'; @@ -16,34 +16,10 @@ export const configCommand: CommandModule = { command: 'config', describe: 'Create or validate Hyperlane configs', builder: (yargs) => - yargs - .command(createCommand) - .command(validateCommand) - .version(false) - .demandCommand(), - handler: () => log('Command required'), -}; - -/** - * Create commands - */ -const createCommand: CommandModule = { - command: 'create', - describe: 'Create a new Hyperlane config', - builder: (yargs) => - yargs.command(createChainConfigCommand).version(false).demandCommand(), + yargs.command(validateCommand).version(false).demandCommand(), handler: () => log('Command required'), }; -const createChainConfigCommand: CommandModuleWithContext<{}> = { - command: 'chain', - describe: 'Create a new, minimal Hyperlane chain config (aka chain metadata)', - handler: async ({ context }) => { - await createChainConfig({ context }); - process.exit(0); - }, -}; - /** * Validate commands */ diff --git a/typescript/cli/src/commands/core.ts b/typescript/cli/src/commands/core.ts index 64c6de52e..54a5786f6 100644 --- a/typescript/cli/src/commands/core.ts +++ b/typescript/cli/src/commands/core.ts @@ -32,8 +32,8 @@ export const coreCommand: CommandModule = { describe: 'Manage core Hyperlane contracts & configs', builder: (yargs) => yargs - .command(configure) .command(deploy) + .command(init) .command(read) .version(false) .demandCommand(), @@ -82,11 +82,11 @@ export const deploy: CommandModuleWithWriteContext<{ }, }; -export const configure: CommandModuleWithContext<{ +export const init: CommandModuleWithContext<{ advanced: boolean; config: string; }> = { - command: 'configure', + command: 'init', describe: 'Create a core configuration, including ISMs and hooks.', builder: { advanced: { diff --git a/typescript/cli/src/commands/registry.ts b/typescript/cli/src/commands/registry.ts index d2679f496..9334064d5 100644 --- a/typescript/cli/src/commands/registry.ts +++ b/typescript/cli/src/commands/registry.ts @@ -1,6 +1,7 @@ import { CommandModule } from 'yargs'; import { createAgentConfig } from '../config/agent.js'; +import { createChainConfig } from '../config/chain.js'; import { CommandContext, CommandModuleWithContext } from '../context/types.js'; import { log, logBlue, logGray, logRed, logTable } from '../logger.js'; @@ -15,12 +16,13 @@ import { ChainType, ChainTypes } from './types.js'; */ export const registryCommand: CommandModule = { command: 'registry', - describe: 'View information about Hyperlane chains in a registry', + describe: 'Manage Hyperlane chains in a registry', builder: (yargs) => yargs - .command(listCommand) .command(addressesCommand) .command(createAgentConfigCommand) + .command(initCommand) + .command(listCommand) .version(false) .demandCommand(), handler: () => log('Command required'), @@ -140,3 +142,12 @@ const createAgentConfigCommand: CommandModuleWithContext<{ process.exit(0); }, }; + +const initCommand: CommandModuleWithContext<{}> = { + command: 'init', + describe: 'Create a new, minimal Hyperlane chain config (aka chain metadata)', + handler: async ({ context }) => { + await createChainConfig({ context }); + process.exit(0); + }, +}; diff --git a/typescript/cli/src/commands/warp.ts b/typescript/cli/src/commands/warp.ts index 1b61c7aff..905d2420f 100644 --- a/typescript/cli/src/commands/warp.ts +++ b/typescript/cli/src/commands/warp.ts @@ -43,8 +43,8 @@ export const warpCommand: CommandModule = { describe: 'Manage Hyperlane warp routes', builder: (yargs) => yargs - .command(configure) .command(deploy) + .command(init) .command(read) .command(send) .version(false) @@ -82,11 +82,11 @@ export const deploy: CommandModuleWithWriteContext<{ }, }; -export const configure: CommandModuleWithContext<{ +export const init: CommandModuleWithContext<{ advanced: boolean; out: string; }> = { - command: 'configure', + command: 'init', describe: 'Create a warp route configuration.', builder: { advanced: {