Repository navigation
Accept multiple directories in nodespace import dir, combined into one summary - #2470
Merged
Merged
Conversation
…e summary import dir took exactly one directory, forcing a shell loop to import several unrelated folders -- one process, one connection, one result set per directory, with no combined summary. The RPC layer already batches an arbitrary file list into one call; the CLI's own base_directory handling (needed for --auto-collection-routing to stay relative to each directory's own root) is what kept it to one directory at a time. A single directory keeps behaving exactly as before (same code path, unmodified, including a scan failure aborting the whole command). Two or more route through a new aggregating path: each directory is walked and imported against its own base_directory, results combine into one summary, and a per-directory scan or import failure is recorded without stopping the rest. Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
…ires Trimming for the token budget had reworded "don't follow up with search calls to verify" away, which broke skill_rules::tests::skill_md_still_mentions_every_interaction_rule (bulk-import-no-followup-search's skill_md_key_phrase). Restored the sentence introduced by #2466 verbatim instead of layering more prose on top of an already near-full budget; the multi-directory form is taught by the worked example already in this section plus the dedicated "Import markdown files" section in references/cli.md. Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
… exit failure - Two directories in one `import dir A B` call that each contain a same-named file (e.g. both have a top-level README.md) compute the identical deterministic root id server-side (derived from each file's path relative to that call's own base_directory). Silently proceeding either skips the second file as "already imported" or, with --replace, overwrites the first's content with the second's -- confirmed via a mutation test that reproduces exactly this collision when the new pre-flight check is disabled. Now scans every directory before issuing any RPC and refuses the whole call, loudly, if any two files would collide, so nothing is written rather than something being silently lost or corrupted. - run_multi_dir returned Ok(()) even when every directory failed, breaking the exit-code contract run_one_dir already had (a scan failure there propagates via `?` to a non-zero process exit). Now returns Err when any directory failed, after printing the combined summary/JSON, so a caller checking the exit code notices. - Removed two GitHub issue numbers embedded in doc comments (CLAUDE.md rule). Co-Authored-By: Claude <[email protected]>
12 tasks
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.
Summary
import dirtook exactly one directory, forcing a shell loop to import several unrelated folders — one process, one connection, one result set per directory, with no combined summary. The RPC layer already batches an arbitrary file list into one call; what kept the CLI to one directory at a time was its ownbase_directoryhandling, needed for--auto-collection-routingto stay relative to each directory's own root rather than a synthesised common ancestor.Changes
ImportDirArgs.directory: String→directories: Vec<String>(positional,num_args = 1.., required)run_one_dir) keeps behaving exactly as before this change — same code path, unmodified, including a scan failure aborting the whole command via?run_multi_dir) walk and import each one against its ownbase_directory, combining results into one summary instead of one per directory. A per-directory scan or import RPC failure is recorded in the combined results and does not stop the rest from runningpackages/skill/SKILL.md+ a new "Import markdown files" worked-example section inreferences/cli.mdcover the multi-directory form,--replaceas a repeatable-sync mechanism, and the "routes relative to its own root" guaranteeAcceptance criteria (issue #2398)
import diraccepts multiple directories:nodespace import dir docs/adr docs/specs--collection,--exclude,--replace,--auto-collection-routing,--use-filename-as-title)--auto-collection-routingroutes relative to each directory's own root, not a synthesised common ancestor--replace/--auto-collection-routing, reframes import as a repeatable syncTest plan
packages/cli/tests/import_dir_multi.rs(real in-process daemon with bothNodeServiceandImportServiceregistered): multiple directories import in one call;--auto-collection-routingroutes each file relative to its own directory's root (proven via collection-membership + "stays a top-level collection" assertions, not just the printedcollectionstring); a missing directory doesn't abort a sibling's import; a single directory still worksbase_directoryproducing a garbled-but-same-leaf-named path slipped past a membership check alone; strengthened it to also assert the collection stays parent-less, which does catch it)bun run test:all— no new failuresbun run quality:fix— clean🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]