What Am I? - point to a project and see what tools, languages and dependencies it has.
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.
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.
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).
$ go install github.com/crqra/whatami/cmd/whatami@latest
$ whatami -h
usage: whatami [-h] [-i=<PATH> ...] [directory]
Flag | Description |
---|---|
-h |
Show usage |
-i <PATH> |
Path patterns to ignore. Accepts many |
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"
}
}
}
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.
- Docker
- Tools:
docker
- Tools:
- Go
- Tools:
go
- Languages:
go
- Tools:
- HCL
- Languages:
hcl
- Languages:
- Java
- Languages:
java
- Languages:
- JavaScript
- Languages:
javascript
- Languages:
- Maven
- Tools:
mvn
- Languages:
java
- Tools:
- NPM
- Tools:
node
,npm
- Tools:
- Taskfile
- Tools:
task
- Tools:
- Terraform
- Tools:
terraform
- Languages:
hcl
- Tools:
- TypeScript
- Tools:
tsc
- Languages:
typescript
- Tools:
- Yarn
- Tools:
yarn
- Tools:
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.
This project is released under the MIT License.