fix(import): clarify conflict diff behavior (#359)#362
Merged
Conversation
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 #359
Closes #360
Summary
Make import conflict behavior explicit and testable:
asm import --force --diffnow fails before reading or modifying a manifest, while the interactive and non-interactive conflict display paths have focused regression coverage.Approach
Selected the minimum-risk validation approach.
--forceremains an unconditional overwrite mode with no conflict construction, and--diffremains a conflict-inspection mode; combining them is rejected as invalid CLI usage rather than changing importer contracts or silently ignoring--diff. The prompt and non-interactive renderer were extracted with injectable I/O seams so their existing behavior can be tested without a real TTY.Decision Record
cmdImport, leaving no practical unit-test seam.--diffis ignored with--force; Option 2 — reject the incompatible flags before import work; Option 3 — construct reporting conflicts during forced overwrites.cmdImport.Analyzed at:
feat/359-import-force-diff @ 1cdee2b(2026-07-11)Changes
src/cli.ts--force --diffbefore manifest I/O, document the incompatibility, and expose testable prompt/diff helpers.src/cli.test.tsTest Results
npm test)Acceptance Criteria Verification
--force --diffno longer silently renders nothingCLI integration: import > import rejects --force with --diff before reading the manifestimport conflict prompt > maps ...parameterized tests insrc/cli.test.tsimport conflict prompt > shows a diff for d, then prompts again for a resolutionimport conflict prompt > marks the ... side newer and the other side older--diffprints actual conflict output without overwritingCLI integration: import > import --diff prints a collected conflict in non-interactive mode