中文
← Errors

F_SYSTEM_DUPLICATE_COMMAND_TOKEN

Duplicate command token

Two registered commands use the same path token or alias under one parent path.

Updated

Reproduction

Canonical path tokens and aliases share one namespace under the same parent path:

src/commands.ts
import { Command, Handler, Module, createApp } from 'func'

@Command('build')
class BuildCommand {
  @Handler()
  run() {}
}

@Command('build')
class RebuildCommand {
  @Handler()
  run() {}
}

@Module({ commands: [BuildCommand, RebuildCommand] })
class AppModule {}

createApp(AppModule)

How to fix it

Keep every token unique under its parent path, or move one Command to a different path:

src/commands.ts
@Command('build')
class BuildCommand {
  @Handler()
  run() {}
}

@Command('rebuild')
class RebuildCommand {
  @Handler()
  run() {}
}

@Module({ commands: [BuildCommand, RebuildCommand] })
class AppModule {}

createApp(AppModule)