         origin:  @detectOrigin
       },
       (err, defaults) =>
-
-        @slugs   = {}
 
         extraUsage = if defaults.extras.length is 0 then '' else  "- #{ defaults.extras.join ' ' }"
 

        exports[key] = value.startLineNumber

    # TODO: ugh, I don't understand relative resolving ;_;
    file = file.substring(1, file.length) if file.match /^\.\./
    @slugs["files"][file] = {objects, exports}
    @slugs

  @mainFileFinder: (package_json_path, main_file) ->
    if main_file.match(/\.js$/)
      main_file = main_file.replace(/\.js$/, ".coffee")
    else

      console.log "Cannot generate documentation: #{ error.message }"
      throw error

  @writeMetadata: (metadataSlugs, options) ->
    fs.writeFileSync path.join(options.output, 'metadata.json'), JSON.stringify(metadataSlugs, null, "    ")

  # Public: Builds and writes to metadata.json
  @generateMetadataSlug: (package_json_path, parser, options) ->
    if fs.existsSync(package_json_path)
      package_json = JSON.parse(fs.readFileSync(package_json_path, 'utf-8'))

    metadata = new Metadata(package_json?["dependencies"] ? {}, parser)
    slug = { main: "", files: {} }

    slug["main"] = @mainFileFinder(package_json_path, package_json?["main"])

    for filename, content of parser.iteratedFiles
      relativeFilename = path.relative(package_json_path, filename)
      # TODO: @lineMapping is all messed up; try to avoid a *second* call to .nodes
      metadata.generate(CoffeeScript.nodes(content))
      @populateSlug(slug, relativeFilename, metadata)

    slug

  # Public: Parse and collect metadata slugs
  @populateSlug: (slug, filename, {defs:unindexedObjects, exports:exports}) ->
    objects = {}
    for key, value of unindexedObjects
      startLineNumber = value.range[0][0]
