   # fixme GG!
   getTotalLoC:(callback)->
     callback null, "776M+"
-
 
   _cbWrapper:(callback)->
     return (rest...)=>

    super

    @kc = KD.singletons.kiteController

    @lastState =
      state    : 'STOPPED'

    @dialogIsOpen = no

  run:(command, callback)->

    KD.requireLogin
      callback : =>
        @askForApprove command, (approved)=>

            @kc.run
              kiteName : 'os'
              method   : command
              vmName   : vm
            , cb
          else unless command is 'vm.info' then @info vm
      onFailMsg : "Login required to use VMs"  unless command is 'vm.info'
      onFail    : =>
        unless command is 'vm.info' then callback yes
        else callback null, state: 'STOPPED'
      silence   : yes

  _runWraper:(command, vm, callback)->
    [callback, vm] = [vm, callback]  unless 'string' is typeof vm
    vm or= @getDefaultVmName vm
    @run vm, command, callback

  start:(vm, callback)->
    @_runWraper 'vm.start', vm, callback

  stop:(vm, callback)->
    @_runWraper 'vm.stop', vm, callback

  reinitialize:(vm, callback)->
    @_runWraper 'vm.reinitialize', vm, callback

  info:(vm, callback)->
    [callback, vm] = [vm, callback]  unless 'string' is typeof vm
    vm or= @getDefaultVmName vm
    @_runWraper 'vm.info', vm, (err, info)=>
      warn "[VM-#{vm}]", err  if err
      @emit 'StateChanged', err, vm, info
      callback? err, vm, info
    , no

  getDefaultVmName:->
    currentGroup = (KD.getSingleton 'groupsController').getGroupSlug()
    if not currentGroup or currentGroup is 'koding' then KD.nick()
    else currentGroup

  # fixme GG!
  getTotalVMCount:(callback)->
