UNPKG

@graphprotocol/graph-cli

Version:

CLI for building for and deploying to The Graph

857 lines • 25.7 kB
{ "version": "0.68.0-alpha-20240208230340-9ea4027", "commands": { "add": { "id": "add", "description": "Adds a new datasource to a subgraph.", "strict": true, "pluginName": "@graphprotocol/graph-cli", "pluginAlias": "@graphprotocol/graph-cli", "pluginType": "core", "aliases": [], "flags": { "help": { "name": "help", "type": "boolean", "char": "h", "description": "Show CLI help.", "allowNo": false }, "abi": { "name": "abi", "type": "option", "summary": "Path to the contract ABI.", "multiple": false }, "start-block": { "name": "start-block", "type": "option", "summary": "The block number to start indexing events from.", "multiple": false }, "contract-name": { "name": "contract-name", "type": "option", "summary": "Name of the contract.", "multiple": false, "default": "Contract" }, "merge-entities": { "name": "merge-entities", "type": "boolean", "summary": "Whether to merge entities with the same name.", "allowNo": false }, "network-file": { "name": "network-file", "type": "option", "summary": "Networks config file path.", "multiple": false, "default": "networks.json" } }, "args": { "address": { "name": "address", "description": "The contract address", "required": true }, "subgraph-manifest": { "name": "subgraph-manifest", "default": "subgraph.yaml" } } }, "auth": { "id": "auth", "description": "Sets the deploy key to use when deploying to a Graph node.", "strict": true, "pluginName": "@graphprotocol/graph-cli", "pluginAlias": "@graphprotocol/graph-cli", "pluginType": "core", "aliases": [], "flags": { "help": { "name": "help", "type": "boolean", "char": "h", "description": "Show CLI help.", "allowNo": false }, "product": { "name": "product", "type": "option", "summary": "Select a product for which to authenticate.", "multiple": false, "options": [ "subgraph-studio", "hosted-service" ], "deprecated": { "message": "In next major version, this flag will be removed. By default we will deploy to the Graph Studio. Learn more about Sunrise of Decentralized Data https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/" } }, "studio": { "name": "studio", "type": "boolean", "summary": "Shortcut for \"--product subgraph-studio\".", "allowNo": false, "exclusive": [ "product" ], "deprecated": { "message": "In next major version, this flag will be removed. By default we will deploy to the Graph Studio. Learn more about Sunrise of Decentralized Data https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/" } } }, "args": { "node": { "name": "node" }, "deploy-key": { "name": "deploy-key" } } }, "build": { "id": "build", "description": "Builds a subgraph and (optionally) uploads it to IPFS.", "strict": true, "pluginName": "@graphprotocol/graph-cli", "pluginAlias": "@graphprotocol/graph-cli", "pluginType": "core", "aliases": [], "flags": { "help": { "name": "help", "type": "boolean", "char": "h", "description": "Show CLI help.", "allowNo": false }, "ipfs": { "name": "ipfs", "type": "option", "char": "i", "summary": "Upload build results to an IPFS node.", "multiple": false }, "output-dir": { "name": "output-dir", "type": "option", "char": "o", "summary": "Output directory for build results.", "multiple": false, "default": "build/" }, "output-format": { "name": "output-format", "type": "option", "char": "t", "summary": "Output format for mappings.", "multiple": false, "options": [ "wasm", "wast" ], "default": "wasm" }, "skip-migrations": { "name": "skip-migrations", "type": "boolean", "summary": "Skip subgraph migrations.", "allowNo": false }, "watch": { "name": "watch", "type": "boolean", "char": "w", "summary": "Regenerate types when subgraph files change.", "allowNo": false }, "network": { "name": "network", "type": "option", "summary": "Network configuration to use from the networks config file.", "multiple": false }, "network-file": { "name": "network-file", "type": "option", "summary": "Networks config file path.", "multiple": false, "default": "networks.json" } }, "args": { "subgraph-manifest": { "name": "subgraph-manifest", "default": "subgraph.yaml" } } }, "clean": { "id": "clean", "description": "Clean the cache and generated files.", "strict": true, "pluginName": "@graphprotocol/graph-cli", "pluginAlias": "@graphprotocol/graph-cli", "pluginType": "core", "aliases": [], "flags": { "help": { "name": "help", "type": "boolean", "char": "h", "description": "Show CLI help.", "allowNo": false }, "codegen-dir": { "name": "codegen-dir", "type": "option", "summary": "Directory where the \"graph codegen\" code is stored.", "multiple": false, "default": "generated/" }, "build-dir": { "name": "build-dir", "type": "option", "summary": "Directory where the \"graph build\" code is stored.", "multiple": false, "default": "build/" } }, "args": {} }, "codegen": { "id": "codegen", "description": "Generates AssemblyScript types for a subgraph.", "strict": true, "pluginName": "@graphprotocol/graph-cli", "pluginAlias": "@graphprotocol/graph-cli", "pluginType": "core", "aliases": [], "flags": { "help": { "name": "help", "type": "boolean", "char": "h", "description": "Show CLI help.", "allowNo": false }, "output-dir": { "name": "output-dir", "type": "option", "char": "o", "summary": "Output directory for generated types.", "multiple": false, "default": "generated/" }, "skip-migrations": { "name": "skip-migrations", "type": "boolean", "summary": "Skip subgraph migrations.", "allowNo": false }, "watch": { "name": "watch", "type": "boolean", "char": "w", "summary": "Regenerate types when subgraph files change.", "allowNo": false }, "uncrashable": { "name": "uncrashable", "type": "boolean", "char": "u", "summary": "Generate Float Subgraph Uncrashable helper file.", "allowNo": false }, "uncrashable-config": { "name": "uncrashable-config", "type": "option", "summary": "Directory for uncrashable config.", "multiple": false, "dependsOn": [ "uncrashable" ], "aliases": [ "uc" ] } }, "args": { "subgraph-manifest": { "name": "subgraph-manifest", "default": "subgraph.yaml" } } }, "create": { "id": "create", "description": "Registers a subgraph name", "strict": true, "pluginName": "@graphprotocol/graph-cli", "pluginAlias": "@graphprotocol/graph-cli", "pluginType": "core", "state": "deprecated", "aliases": [], "deprecationOptions": { "message": "In next major version, this command will be merged as a subcommand for `graph local`." }, "flags": { "help": { "name": "help", "type": "boolean", "char": "h", "description": "Show CLI help.", "allowNo": false }, "node": { "name": "node", "type": "option", "char": "g", "summary": "Graph node to create the subgraph in.", "required": true, "multiple": false }, "access-token": { "name": "access-token", "type": "option", "summary": "Graph access token.", "multiple": false } }, "args": { "subgraph-name": { "name": "subgraph-name", "required": true } } }, "deploy": { "id": "deploy", "description": "Deploys a subgraph to a Graph node.", "strict": true, "pluginName": "@graphprotocol/graph-cli", "pluginAlias": "@graphprotocol/graph-cli", "pluginType": "core", "aliases": [], "flags": { "help": { "name": "help", "type": "boolean", "char": "h", "description": "Show CLI help.", "allowNo": false }, "product": { "name": "product", "type": "option", "summary": "Select a product for which to authenticate.", "multiple": false, "options": [ "subgraph-studio", "hosted-service" ] }, "studio": { "name": "studio", "type": "boolean", "summary": "Shortcut for \"--product subgraph-studio\".", "allowNo": false, "exclusive": [ "product" ] }, "node": { "name": "node", "type": "option", "char": "g", "summary": "Graph node for which to initialize.", "multiple": false }, "deploy-key": { "name": "deploy-key", "type": "option", "summary": "User deploy key.", "multiple": false, "exclusive": [ "access-token" ] }, "access-token": { "name": "access-token", "type": "option", "multiple": false, "exclusive": [ "deploy-key" ], "deprecated": { "to": "deploy-key", "message": "In next version, we are removing this flag in favor of '--deploy-key'" } }, "version-label": { "name": "version-label", "type": "option", "char": "l", "summary": "Version label used for the deployment.", "multiple": false }, "ipfs": { "name": "ipfs", "type": "option", "char": "i", "summary": "Upload build results to an IPFS node.", "multiple": false, "default": "https://api.thegraph.com/ipfs/api/v0" }, "ipfs-hash": { "name": "ipfs-hash", "type": "option", "summary": "IPFS hash of the subgraph manifest to deploy.", "required": false, "multiple": false }, "headers": { "name": "headers", "type": "option", "summary": "Add custom headers that will be used by the IPFS HTTP client.", "multiple": false, "default": {}, "aliases": [ "hdr" ] }, "debug-fork": { "name": "debug-fork", "type": "option", "summary": "ID of a remote subgraph whose store will be GraphQL queried.", "multiple": false }, "output-dir": { "name": "output-dir", "type": "option", "char": "o", "summary": "Output directory for build results.", "multiple": false, "default": "build/" }, "skip-migrations": { "name": "skip-migrations", "type": "boolean", "summary": "Skip subgraph migrations.", "allowNo": false }, "watch": { "name": "watch", "type": "boolean", "char": "w", "summary": "Regenerate types when subgraph files change.", "allowNo": false }, "network": { "name": "network", "type": "option", "summary": "Network configuration to use from the networks config file.", "multiple": false }, "network-file": { "name": "network-file", "type": "option", "summary": "Networks config file path.", "multiple": false, "default": "networks.json" }, "from-hosted-service": { "name": "from-hosted-service", "type": "option", "summary": "Hosted service Subgraph Name to deploy to studio.", "multiple": false } }, "args": { "subgraph-name": { "name": "subgraph-name" }, "subgraph-manifest": { "name": "subgraph-manifest", "default": "subgraph.yaml" } } }, "init": { "id": "init", "description": "Creates a new subgraph with basic scaffolding.", "strict": true, "pluginName": "@graphprotocol/graph-cli", "pluginAlias": "@graphprotocol/graph-cli", "pluginType": "core", "aliases": [], "flags": { "help": { "name": "help", "type": "boolean", "char": "h", "description": "Show CLI help.", "allowNo": false }, "protocol": { "name": "protocol", "type": "option", "multiple": false, "options": [ "arweave", "ethereum", "near", "cosmos", "substreams" ] }, "product": { "name": "product", "type": "option", "summary": "Selects the product for which to initialize.", "multiple": false, "options": [ "subgraph-studio", "hosted-service" ], "deprecated": { "message": "In next major version, this flag will be removed. By default we will deploy to the Graph Studio. Learn more about Sunrise of Decentralized Data https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/" } }, "studio": { "name": "studio", "type": "boolean", "summary": "Shortcut for \"--product subgraph-studio\".", "allowNo": false, "exclusive": [ "product" ], "deprecated": { "message": "In next major version, this flag will be removed. By default we will deploy to the Graph Studio. Learn more about Sunrise of Decentralized Data https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/" } }, "node": { "name": "node", "type": "option", "char": "g", "summary": "Graph node for which to initialize.", "multiple": false }, "allow-simple-name": { "name": "allow-simple-name", "type": "boolean", "description": "Use a subgraph name without a prefix.", "allowNo": false, "deprecated": { "message": "In next major version, this flag will be removed. By default we will deploy to the Graph Studio. Learn more about Sunrise of Decentralized Data https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/" } }, "from-contract": { "name": "from-contract", "type": "option", "description": "Creates a scaffold based on an existing contract.", "multiple": false, "exclusive": [ "from-example" ] }, "from-example": { "name": "from-example", "type": "option", "description": "Creates a scaffold based on an example subgraph.", "multiple": false, "exclusive": [ "from-contract" ] }, "contract-name": { "name": "contract-name", "type": "option", "description": "Name of the contract.", "helpGroup": "Scaffold from contract", "multiple": false, "dependsOn": [ "from-contract" ] }, "index-events": { "name": "index-events", "type": "boolean", "description": "Index contract events as entities.", "helpGroup": "Scaffold from contract", "allowNo": false, "dependsOn": [ "from-contract" ] }, "skip-install": { "name": "skip-install", "type": "boolean", "summary": "Skip installing dependencies.", "allowNo": false }, "skip-git": { "name": "skip-git", "type": "boolean", "summary": "Skip initializing a Git repository.", "allowNo": false, "deprecated": { "message": "In next major version, this flag will be removed. By default we will stop initializing a Git repository." } }, "start-block": { "name": "start-block", "type": "option", "description": "Block number to start indexing from.", "helpGroup": "Scaffold from contract", "multiple": false, "dependsOn": [ "from-contract" ] }, "abi": { "name": "abi", "type": "option", "summary": "Path to the contract ABI", "multiple": false, "dependsOn": [ "from-contract" ] }, "spkg": { "name": "spkg", "type": "option", "summary": "Path to the SPKG file", "multiple": false }, "network": { "name": "network", "type": "option", "summary": "Network the contract is deployed to.", "description": "Check https://thegraph.com/docs/en/developing/supported-networks/ for supported networks", "multiple": false, "dependsOn": [ "from-contract" ] } }, "args": { "subgraphName": { "name": "subgraphName" }, "directory": { "name": "directory" } } }, "local": { "id": "local", "description": "Runs local tests against a Graph Node environment (using Ganache by default).", "strict": true, "pluginName": "@graphprotocol/graph-cli", "pluginAlias": "@graphprotocol/graph-cli", "pluginType": "core", "aliases": [], "flags": { "help": { "name": "help", "type": "boolean", "char": "h", "description": "Show CLI help.", "allowNo": false }, "node-logs": { "name": "node-logs", "type": "boolean", "summary": "Print the Graph Node logs.", "allowNo": false }, "ethereum-logs": { "name": "ethereum-logs", "type": "boolean", "summary": "Print the Ethereum logs.", "allowNo": false }, "compose-file": { "name": "compose-file", "type": "option", "summary": "Custom Docker Compose file for additional services.", "multiple": false }, "node-image": { "name": "node-image", "type": "option", "summary": "Custom Graph Node image to test against.", "multiple": false, "default": "graphprotocol/graph-node:latest" }, "standalone-node": { "name": "standalone-node", "type": "option", "summary": "Use a standalone Graph Node outside Docker Compose.", "multiple": false }, "standalone-node-args": { "name": "standalone-node-args", "type": "option", "summary": "Custom arguments to be passed to the standalone Graph Node.", "multiple": false, "dependsOn": [ "standalone-node" ] }, "skip-wait-for-ipfs": { "name": "skip-wait-for-ipfs", "type": "boolean", "summary": "Don't wait for IPFS to be up at localhost:15001", "allowNo": false }, "skip-wait-for-ethereum": { "name": "skip-wait-for-ethereum", "type": "boolean", "summary": "Don't wait for Ethereum to be up at localhost:18545", "allowNo": false }, "skip-wait-for-etherium": { "name": "skip-wait-for-etherium", "type": "boolean", "summary": "Don't wait for Ethereum to be up at localhost:18545", "allowNo": false, "deprecated": { "message": "Use --skip-wait-for-ethereum instead" } }, "skip-wait-for-postgres": { "name": "skip-wait-for-postgres", "type": "boolean", "summary": "Don't wait for Postgres to be up at localhost:15432", "allowNo": false }, "timeout": { "name": "timeout", "type": "option", "summary": "Time to wait for service containers in milliseconds.", "multiple": false, "default": 120000 } }, "args": { "local-command": { "name": "local-command", "required": true } } }, "remove": { "id": "remove", "description": "Unregisters a subgraph name", "strict": true, "pluginName": "@graphprotocol/graph-cli", "pluginAlias": "@graphprotocol/graph-cli", "pluginType": "core", "state": "deprecated", "aliases": [], "deprecationOptions": { "message": "In next major version, this command will be merged as a subcommand for `graph local`." }, "flags": { "help": { "name": "help", "type": "boolean", "char": "h", "description": "Show CLI help.", "allowNo": false }, "node": { "name": "node", "type": "option", "char": "g", "summary": "Graph node to delete the subgraph from.", "required": true, "multiple": false }, "access-token": { "name": "access-token", "type": "option", "summary": "Graph access token.", "multiple": false } }, "args": { "subgraph-name": { "name": "subgraph-name", "required": true } } }, "test": { "id": "test", "description": "Runs rust binary for subgraph testing.", "strict": true, "pluginName": "@graphprotocol/graph-cli", "pluginAlias": "@graphprotocol/graph-cli", "pluginType": "core", "aliases": [], "flags": { "help": { "name": "help", "type": "boolean", "char": "h", "description": "Show CLI help.", "allowNo": false }, "coverage": { "name": "coverage", "type": "boolean", "char": "c", "summary": "Run the tests in coverage mode.", "allowNo": false }, "docker": { "name": "docker", "type": "boolean", "char": "d", "summary": "Run the tests in a docker container (Note: Please execute from the root folder of the subgraph).", "allowNo": false }, "force": { "name": "force", "type": "boolean", "char": "f", "summary": "Binary - overwrites folder + file when downloading. Docker - rebuilds the docker image.", "allowNo": false }, "logs": { "name": "logs", "type": "boolean", "char": "l", "summary": "Logs to the console information about the OS, CPU model and download url (debugging purposes).", "allowNo": false }, "recompile": { "name": "recompile", "type": "boolean", "char": "r", "summary": "Force-recompile tests.", "allowNo": false }, "version": { "name": "version", "type": "option", "char": "v", "summary": "Choose the version of the rust binary that you want to be downloaded/used.", "multiple": false } }, "args": { "datasource": { "name": "datasource" } } } } }