NEMAR CLI
The nemar-cli package provides a command-line interface for managing datasets within NEMAR (Neuroelectromagnetic Data Archive and Tools Resource), an initiative focused on curating and sharing human neuroelectromagnetic (EEG, MEG, iEEG) data. It facilitates interaction with BIDS-formatted datasets, often leveraging DataLad for version control and data management, and integrating with resources like OpenNeuro. This CLI is designed to help researchers create, update, and manage neuroimaging datasets, particularly those with restrictive licenses that prevent hosting on fully public repositories, while still ensuring free access for academic use. The current stable version is 0.7.26, indicating active development with potential for frequent updates and feature enhancements before a 1.0 release. Its key differentiators include specialized support for neuroimaging data standards (BIDS), integration with advanced data versioning systems (DataLad), and its role in an ecosystem that provides high-performance computing resources via the Neuroscience Gateway. It aims to streamline data management workflows for neuroscientists.
Common errors
-
nemar-cli: command not found
cause The `nemar-cli` executable is not in your system's PATH, either because it wasn't installed globally or `npx`/`bunx` was not used.fixInstall globally: `bun install -g nemar-cli`. Or use `npx nemar-cli [command]` or `bunx nemar-cli [command]`. -
Error: Bun (version >=1.0.0) is required but not found or not compatible.
cause The `nemar-cli` package specifies a `bun` engine requirement (>=1.0.0) which is not met by the current runtime.fixInstall Bun or update it to the latest version (e.g., `curl -fsSL https://bun.sh/install | bash`) and ensure your shell is configured to use it. -
DataLadError: 'git-annex' is not available in PATH
cause DataLad, which `nemar-cli` depends on for certain operations, requires `git-annex` to be installed and accessible in your system's PATH.fixInstall `git-annex` using your system's package manager (e.g., `sudo apt install git-annex`, `brew install git-annex`) and verify it's in your PATH (`which git-annex`). -
BIDSValidationError: Subject 'sub-01' is missing required file 'sub-01_ses-01_task-rest_eeg.bids.json'
cause A dataset operation failed due to non-compliance with the Brain Imaging Data Structure (BIDS) specification, often related to missing or incorrectly named files/metadata.fixReview the BIDS specification for the required file structure and naming conventions. Use BIDS validators to check your dataset before using `nemar-cli` commands that rely on BIDS compliance.
Warnings
- breaking The package requires Bun runtime version >=1.0.0. Using Node.js or an older Bun version will result in errors and prevent the CLI from running.
- gotcha As a pre-1.0.0 release, `nemar-cli` may introduce breaking changes in minor or patch versions. Command syntax, options, or output formats can change without a major version bump, requiring frequent review of release notes.
- gotcha `nemar-cli` integrates with DataLad for dataset management. Proper functioning requires DataLad and its dependencies (like git-annex) to be installed and configured correctly on the user's system, which are external to npm.
- gotcha When running `nemar-cli` commands that interact with cloud storage (e.g., AWS S3 for DataLad datasets), appropriate authentication and authorization credentials must be configured in your environment.
Install
-
npm install nemar-cli -
yarn add nemar-cli -
pnpm add nemar-cli
Imports
- nemar-cli
import nemarCli from 'nemar-cli'
npm install -g nemar-cli nemar-cli --version
- nemar-cli
node nemar-cli.js --help
npx nemar-cli --help
- nemar-cli dataset create
nemar-cli createdataset MyNewDataset
nemar-cli dataset create --name 'MyNewDataset' --bids --datalad
Quickstart
#!/bin/bash # Ensure Bun is installed and meets the engine requirement. if ! command -v bun &> /dev/null || ! bun --version | grep -q "^1\."; then echo "Error: Bun (version >=1.0.0) is required but not found or not compatible." echo "Please install Bun: https://bun.sh/docs/installation" exit 1 fi # Install the nemar-cli globally using Bun bun install -g nemar-cli echo "\nNEMAR CLI installed. Verifying installation:" nemar-cli --version echo "\nListing available commands:" nemar-cli --help echo "\nExample: Initializing a new NEMAR dataset (interactive, requires user input):" # This command initiates an interactive process for dataset creation. # For automated scripts, specific subcommands and flags would be used. # nemar-cli dataset create echo "\nTo clean up the global installation (optional):" # bun uninstall -g nemar-cli