0.1.66 • Published 2 years ago

@testmachine.ai/cli v0.1.66

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

TestMachine CLI

The command-line interface to the TestMachine blockchain security system.

Summary

Testmachine is a tool for identitying and reporting vulnerabilities on Solidity smart contracts, with the goal of making code more consistent and avoiding bugs.

About the project

This is an npm project implemented on typescript and it has the following folder structure:

FileDescription
getSpinner.tsGenerates a console spinner given a text
getUniqueId.tsGenerates a unique Id for repositories when no name was specified on creation
handleError.tsFormat and prints a given error
getDirectoryFiles.tsGet the list of files of a directory
FileDescription
api.tsDefines and export an object to interact with testmachine api
config.tsSet some constants that will be used along the project
FileDescription
analyses.tsHandle interactions with the api to list and get analysis
repositories.tsHandle interactions with the api to list and create repositories
snapshots.tsHandle interactions with the api to list, create or analyze snapshots

IDE Extensions

Install the following IDE extensions to help lint & format code while writing

  • EditorConfig for VS Code
  • ESLint
  • Prettier

Setup

  • Node > 18.0.0
  • Npm > 8.6.0

Run $ npm i to install dependencies and $ npm run build to build the project

How To

Access and run cli commands

There are a few ways of running cli commands after built:

  • run $node ./build/index.js --token <token> followed by any available command (requires to rebuild after every change).
  • run $tsx ./src/index.ts --token <token> followed by any available command.
  • run $npm run execute -- --token <token> followed by any available command.

where \<token> is the api token got from the API.

Note: In the following sections, it is assumed that tm is an alias or symbolic link set for the cli.

Create a repository

Run the following command:

tm repo create --name \<name>

where --name is an optional argument to set a customized name for the repository

List repositories

Run the following command:

tm repo list

List snapshots

Run the following command:

tm snapshot list --repo-id \<id>

where --repo-id is the repository which snapshots will be queried

Create a snapshot

Run the following command:

tm snapshot create --repo-id \<id> --file \<path/to/files-to-upload>

where:

  • --repo-id is the repository for which the snapshot will be created
  • --file is selects a folder or a file to upload to the snapshot source tree

Create a snapshot and analyze it inmediately

Run the following command:

tm snapshot create-analyze --repo-id \<id> --file \<path/to/files-to-upload>

where:

  • --repo-id is the repository for which the snapshot will be created
  • --file is selects a folder or a file to upload to the snapshot source tree

This command is useful when using the CLI from an automated process where the repository id is fixed/known (like from a Github Action for example)

Analyze a snapshot

Run the following command:

tm snapshot analyze --snapshot-id \<id>

where --snapshot-id is the snapshot which source tree will be analyzed

List snapshot's analyses

Run the following command:

tm analyses list --snapshot-id \<id>

where --snapshot-id is the snapshot for which analyses will be queried

Get specific snapshot's analysis

Run the following command:

tm analyses list --analysis-id \<id>

where --analysis-id is the analysis to be queried

Get report of analysis

Run the following command:

tm analyses report --analysis-id \<id> where --analysis-id is the analysis to be queried

0.1.54

2 years ago

0.1.55

2 years ago

0.1.56

2 years ago

0.1.57

2 years ago

0.1.58

2 years ago

0.1.50

2 years ago

0.1.49

2 years ago

0.1.41

2 years ago

0.1.43

2 years ago

0.1.45

2 years ago

0.1.46

2 years ago

0.1.47

2 years ago

0.1.48

2 years ago

0.1.40

2 years ago

0.1.39

2 years ago

0.1.30

2 years ago

0.1.31

2 years ago

0.1.33

2 years ago

0.1.34

2 years ago

0.1.35

2 years ago

0.1.37

2 years ago

0.1.27

2 years ago

0.1.28

2 years ago

0.1.63

2 years ago

0.1.64

2 years ago

0.1.65

2 years ago

0.1.66

2 years ago

0.1.24

2 years ago

0.1.25

2 years ago

0.1.26

2 years ago

0.1.60

2 years ago

0.1.61

2 years ago

0.1.62

2 years ago

0.1.20

2 years ago

0.1.10

2 years ago

0.1.22

2 years ago

0.1.11

2 years ago

0.1.12

2 years ago

0.1.13

2 years ago

0.1.8

2 years ago

0.1.18

2 years ago

0.1.19

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

1.0.3

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago