             content_type: 'json'
       , next
     (res, body, next) ->      # create team
+      return next(Error(JSON.stringify(body))) unless body.id
+
+      console.log team.slug, 'create team'
       request.post
         url: github 'orgs/nko3/teams'
         json:

          permission: 'admin'
      , next
    (res, body, next) ->      # save team id
      team.github = body if body.id
      unless team.github
        console.warn "!!! Proceeding without accurate GitHub team id"
        team.github = { id: 0 }
      team.save next
    (team, n, next) ->        # get people
      Person.find { _id: { $in: team.peopleIds } }, (err, people) ->
        next err, team, people
    (team, people, next) ->   # add members
      async.forEach people, (person, next) ->
        request.put
          url: github "teams/#{team.github.id}/members/#{person.github.login}"
          json: {}
        , next
      , next
    (next) ->                 # seed repo
      createRepo = spawn './create-repo.sh',
        [ team.slug, team.code, team.name, team.github.id ],
        cwd: __dirname
      createRepo.stdout.on 'data', (s) -> console.log s.toString()
      createRepo.on 'exit', -> next()
  ], next
, 5 # workers

Team.find { slug: 'fortnight-labs' }, (err, teams) ->
  throw err if err
  queue.push teams

queue.drain = -> mongoose.connection.close()

          private: true
      , next
    (res, body, next) ->      # create push hook
      return next(Error(JSON.stringify(body))) unless body.id

      console.log team.slug, 'create hook'
      request.post
        url: github "repos/nko3/#{team.slug}/hooks"
        json:
