Skip to content
/ whatami Public

Describe a project's tools, languages and dependencies

Notifications You must be signed in to change notification settings

jcrqr/whatami

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

whatami

What Am I? - point to a project and see what tools, languages and dependencies it has.

About

What?

Tool that recursively walks a directory and based on the files present derives:

  • Tools: package managers, compilers, linters, etc.
  • Languages: markup, configuration and programming languages
  • Dependencies: software dependencies from package managers configuration files

For each of the above a version may be available in which case it's included.

Why?

My main use case is to use the information outputted to create dynamic CI/CD pipelines. Based on the output, I know what tools I need to have in place for a particular project and can even infer what commands I can run to perform certain tasks like building or testing the project.

How?

For each file or directory found while walking, a set of pre-defined adapters is executed to derive tools, languages and dependencies.

If more than one adapter finds the same tools, languages or dependencies, they're de-duplicated based on the version. Wins the first tool, language or dependency that for which a version was found (regardless if subsequent findings also have a version).

Installing

$ go install github.com/crqra/whatami/cmd/whatami@latest

Usage

$ whatami -h
usage: whatami [-h] [-i=<PATH> ...] [directory]

Flags

Flag Description
-h Show usage
-i <PATH> Path patterns to ignore. Accepts many

Example

In a standard TypeScript project:

$ ls
index.ts node_modules/ package-lock.json package.json

# Run whatami
$ whatami -i node_modules
See output
{
  "tools": {
    "node": {
      "version": "~15"
    },
    "npm": {
      "version": "~1.0.20"
    },
    "tsc": {
      "version": "^4.7.3"
    }
  },
  "dependencies": {
    "express": {
      "version": "^4.18.1",
      "type": "production"
    },
    "typescript": {
      "version": "^4.7.3",
      "type": "development"
    }
  },
  "languages": {
    "typescript": {
      "version": "^4.7.3"
    }
  }
}

Adapters

An adapter is an interface that implements the functionality to derive one or more tools, languages or dependencies based on a given file.

type Adapter interface {
	FindTools(f *file.File) ([]*Tool, error)
	FindDependencies(f *file.File) ([]*Dependency, error)
	FindLanguages(f *file.File) ([]*Language, error)
}

See the links in the list of supported adapters below for example implementations.

Supported

If the adapter you need is not on the list above, please open an issue or a pull request. Use the adapter template to get started.

License

This project is released under the MIT License.

About

Describe a project's tools, languages and dependencies

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Languages