Package: d3-cli
ManySecured d3-cliUtility cli for ManySecured-D3 claimsInstallationThis api may be installed using pip like so:pip install d3-cliWhen developing these scripts,Python Poetryis used to install and manage dependencies as well as publish toPyPI.Poetry will create a python isolated virtual environment in the./.venvfolder and install dependencies if you run:poetryinstallYou cannot run the cli or scripts directly from the./src/d3-scriptssince we are usingPython relative imports.Instead, you must run the d3-cli script defined in the[tool.poetry.scripts]field ofpyproject.toml: You can run the command line interface locally, directly from source code without building/installing by runningpoetry run d3-cli.Usageusage: d3-cli [-h] [--version] [--guid] [--output [OUTPUT]] [--mode [{build,lint,export,website}]] [--skip-mal][--build-dir [BUILD_DIR]] [--check_uri_resolves] [--web-address [WEB_ADDRESS]] [--verbose | --quiet][input ...]ManySecured D3 CLI for creating, linting and exporting D3 claimspositional arguments:input                 folders containing D3 YAML files.optional arguments:-h, --help            show this help message and exit--version             show the version and exit.--guid, --uuid        generate and show guid and exit.--output [OUTPUT], -o [OUTPUT]directory in which to output built claims.--mode [{build,lint,export,website}], -m [{build,lint,export,website}]mode to run d3-cli in.build creates a directory of D3 claims in json format, with the parent and child types resolved, and CVEvulnerabilities added.lint lints the claims to check they confirm to the yaml syntax and schemas.export creates a directory with the CSVs of the tables of types, behaviours andfirmwares.website creates a directory containing the source for a static website of claims which can be browsed,with unique uris for each type.--skip-mal            skip malicious url lookup.This takes a bit of time, and requires an internet connectionso you may wish to skip this step for local testing.--build-dir [BUILD_DIR]build directory with json claims to export to build website with.Specifying this will skip build step in export mode and website mode.--check_uri_resolves  check that URIs/refs resolve.This can be very slow, so you may want to leave this off normally.--web-address [WEB_ADDRESS]web address to use for website build--verbose, -v--quiet, -qExample: d3-cli ./manufacturersTestsTests can be run via:poetryrunpytestPublishThe d3-cli utility is publishedhere.In order to publish you must run:poetry build
poetry publishAnd then enter the credentials for the NquiringMinds pypi account.D3 type explorer web pageThis static page is generated from (post-processed) D3 statements andhosted here. This site relies upon two Github actions in theD3DB repositoryRun D3 Build of website for github pages - processes all files, exporting html filesPublish website (main-branch only) deploys the pelecan site to Github pagesIn order for the pelican graphviz plugin which generates the digraph's in the webpage to work you need to have graphviz installed on your pc. For linux machines this can be done withsudo apt install graphviz, for windows graphviz installers may be downloadedfrom here.Running LocallyTo generate the site files inside a defined directory:cd d3-cli
poetry install
poetry run d3-cli --mode website "path-to-d3-yaml-files" --output "output-file"serving the static site:cd "output-file"/output
python -m http.server 8000