Repository navigation
Default-skip stimuli/ and derivatives/ on download and get - #405
Merged
Merged
Conversation
Add excludeStimuli/excludeDerivatives options to buildBidsFilterArgs that emit '--exclude' patterns for stimuli/** and derivatives/** (top-level and nested). The defaults do not flip 'active', so callers using --no-data are unaffected. countPendingDownload now accepts extraArgs so the precount sees the same matchers as the subsequent 'git annex get' run, keeping the progress denominator accurate. Refs #402
Wire the new exclude options into 'nemar dataset download' and 'nemar dataset get'. Both default-skip stimuli/ and derivatives/; --stimuli and --derivatives opt back in. The pointer files are still cloned, so users can fetch the content later. For 'get', the default-skip applies only when no explicit paths are given. Naming a path is treated as the user's explicit filter, so 'nemar dataset get stimuli/' does what you'd expect. Also clarifies the parent 'nemar dataset --help' to spell out that 'download' runs OUTSIDE a dataset directory (one-shot clone+fetch) while 'get' runs INSIDE an already-cloned dataset directory (fetch only). Closes #402
Document the new --stimuli/--derivatives flags in docs/guides/downloading.md and docs/commands/dataset.md. Also note that explicit paths in 'get' bypass the default-skip. Refs #402
Three fixes from review: 1. get command was printing the 'skipping stimuli/' summary AFTER the 'All data files already present' early-return, so users with stimuli-only datasets never saw the hint. Move the summary print above the early-return. 2. Help text claimed default-skip applies to 'downloads' generally, but OpenNeuro datasets go through a different code path that ignores the flags. Qualify the wording to NEMAR datasets and explicitly note OpenNeuro behavior. 3. Refine excludeStimuli/excludeDerivatives JSDoc to describe what the function does (emit excludes) rather than describe the surrounding workflow (clone+pointer behavior is true but not a property of this function). Three new tests, regression guards for review-flagged gaps: - New chooseGetFilter helper centralizes 'explicit paths bypass default-skip' rule + 6 unit tests so a future refactor can't silently break 'nemar dataset get stimuli/'. - CLI test asserting 'nemar dataset download <id> --no-data' does NOT trigger the 'filters imply data download' conflict (depends on default excludes not flipping filter.active). - countPendingDownload extraArgs test: clone with both data.bin and stimuli/sound.bin pending, assert unfiltered=2/300B and stimuli-excluded=1/100B. Refs #402
Contributor
Author
|
Review pass complete. Fixes pushed in 0f09228. Critical fixes (silent-failure-hunter + comment-analyzer):
Test gap fixes (pr-test-analyzer):
Skipped findings (out of scope or accepted):
All 36 unit tests pass; all 5 Dataset Download CLI tests pass; build clean. |
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR405Version: 🤖 Updated on each push. |
This was referenced May 10, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #402
Summary
Some NEMAR datasets will soon ship
stimuli/files inside the dataset tree, andderivatives/folders are already common on existing datasets. Both can be very large and most users don't need them on first download. This PR makes the default behavior ofnemar dataset downloadandnemar dataset getskip annex content under those folders, with new opt-in flags to fetch them.The git-annex pointer files (symlinks) are still cloned, so the dataset tree is intact and users can fetch the content later with
nemar dataset get --stimuliornemar dataset get --derivatives.Behavior
nemar dataset download nm000104skipsstimuli/**andderivatives/**(top-level and nested).nemar dataset download nm000104 --stimuliincludes stimuli/ content.nemar dataset download nm000104 --stimuli --derivativesincludes both.nemar dataset get(no arg) follows the same default skip; pass--stimuli/--derivativesto opt in.nemar dataset get stimuli/(explicit path) bypasses the default skip, so naming a path Just Works.--no-datastill skips everything (unchanged).Implementation
src/lib/bids-filter.ts: newexcludeStimuli/excludeDerivativesoptions append the appropriate--excludeglob pairs. They do NOT flip the existingactiveflag, so the existing--no-data + filtersconflict check still only triggers on explicit user filters.src/lib/git-annex.ts:countPendingDownloadnow accepts anextraArgsparameter so the progress-bar precount applies the same matchers the subsequentgit annex getwill use.src/commands/dataset.ts: bothdownloadandgetlearn--stimuliand--derivatives. The parentnemar dataset --helpnow explicitly contrasts the two:downloadruns OUTSIDE a dataset directory (one-shot clone + fetch),getruns INSIDE an already-cloned dataset directory (fetch only).Tests
test/bids-filter.test.tscovering default-skip, opt-in, composition with positive filters, ordering of default vs user excludes, and theactiveflag invariant.test/cli.test.tsto assert the new flags appear in--helpand that the parent--help-allspells out the download-vs-get distinction.Test plan
bun test test/bids-filter.test.ts(24 pass)bun test test/git-annex-precount.test.ts(5 pass)bun test test/cli.test.ts -t "Dataset Download"(4 pass, 0 fail)bun run build(clean)