Skip to content

Check every file below the working directory when no paths are given - #2698

Merged
somewhatabstract merged 7 commits into
mainfrom
claude/jolly-galileo-72zesp-default-include
Nov 11, 2026
Merged

somewhatabstract merged 7 commits into
mainfrom
claude/jolly-galileo-72zesp-default-include

Conversation

@somewhatabstract

@somewhatabstract somewhatabstract commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner

Running checksync with no include paths always failed with "No matching files". The default include glob was ${process.cwd()}**, with no /, so it matched names next to the working directory instead of the files in it. It was also worked out when the module loaded, before --cwd changes folder.

Now, when neither the arguments nor the config file give include globs, checksync checks every file below the folder it started in, after any --cwd. A config file moves the working directory to its own folder, so determineOptions remembers the starting folder first. defaultIncludeGlobs then builds an escaped glob for that folder, relative to the new working directory. If the starting folder isn't inside the config's folder (for example, --config names a file in a folder beside it), everything below the config's folder is checked instead. That keeps the config's exclude globs working. The help text now says this.

This is a patch fix for 11.x, found while porting getFiles to Rust (#2615). It adds four conformance cases, each with its own fixture and config so the repository's config isn't used:

  • cli/no-paths: no arguments.
  • cli/no-paths-below-config: no arguments, run from a subfolder whose parent holds the config and a broken file.
  • cli/no-paths-cwd-option: the same subfolder, given with --cwd.
  • cli/no-paths-config-elsewhere: --config names a config in a folder beside the starting folder, and that config's folder has a broken file.

Test plan

  • In a folder with a package.json and a pair of synced files, run checksync with no arguments. It reports "Everything is in sync!" instead of "No matching files".
  • Put a .checksyncrc.json and a file with a lone sync-end tag in that folder, then run checksync from a subfolder. Only the subfolder's files are checked. Run it again with --cwd <subfolder> from elsewhere, and the result is the same.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QjLhVH1NnUc7MzCSYLd8Yn

…iven

`defaultOptions.includeGlobs` was `${process.cwd()}**`, with no `/`, so
it matched names beside the working directory rather than files in it:
running checksync with no include paths always failed with "No matching
files". It was also worked out at import, before `--cwd` changes folder.

The default is now `["."]`. getFiles expands a folder to everything below
it when files are found, so it follows `--cwd` and works on Windows.

Adds a `cli/no-paths` conformance case with its own fixture, which has
its own configuration so the repository's isn't found. Its golden comes
in the next commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QjLhVH1NnUc7MzCSYLd8Yn
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QjLhVH1NnUc7MzCSYLd8Yn
@changeset-bot

changeset-bot Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 39c1152

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
checksync Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov

codecov Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (2440062) to head (39c1152).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main     #2698   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           92        93    +1     
  Lines         3157      3171   +14     
  Branches      2374      2383    +9     
=========================================
+ Hits          3157      3171   +14     
Flag Coverage Δ
typescript 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/conformance/constants.ts 100.00% <100.00%> (ø)
src/default-include-globs.ts 100.00% <100.00%> (ø)
src/default-options.ts 100.00% <ø> (ø)
src/determine-options.ts 100.00% <100.00%> (ø)
src/help.ts 100.00% <ø> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2440062...39c1152. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codecov

codecov Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 485 bytes (0.07%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
checksync-cjs 686.16kB 485 bytes (0.07%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: checksync-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
main.js 485 bytes 686.16kB 0.07%

Files in main.js:

  • ./src/default-include-globs.ts → Total Size: 1.08kB

  • ./src/determine-options.ts → Total Size: 2.74kB

  • ./src/default-options.ts → Total Size: 526 bytes

  • ./src/help.ts → Total Size: 8.23kB

  • ./package.json → Total Size: 23 bytes

A configuration file found above the working directory becomes the new
working directory, so the `.` default checked everything below the
configuration instead. determineOptions now remembers the folder it
started in, after any `--cwd`, and when neither the arguments nor the
configuration give include globs, uses a glob for everything below it.

defaultIncludeGlobs builds that glob relative to the new working
directory, escaped with fast-glob. The default itself is now `**`, so it
no longer relies on getFiles turning a bare folder into `folder/**`.

Adds `cli/no-paths-below-config` and `cli/no-paths-cwd-option`
conformance cases, run from below a configuration file that has a broken
file beside it. Their goldens come in the next commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QjLhVH1NnUc7MzCSYLd8Yn
When `--config` names a file whose folder doesn't contain the starting
folder, a glob for the starting folder would begin with `..`, which the
configuration's exclude globs can't match. defaultIncludeGlobs now falls
back to everything below the configuration's folder in that case, and the
help says so.

determineOptions now picks the include globs with one `??` chain, and the
test mocks of loaded configurations are cast so the typecheck passes.

Adds a `cli/no-paths-config-elsewhere` conformance case, and updates the
help goldens and snapshots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QjLhVH1NnUc7MzCSYLd8Yn
The no-paths-below-config fixture's configuration now excludes a folder
holding a broken file, so cli/no-paths-config-elsewhere shows the
exclude globs still apply when the default falls back to the
configuration's folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QjLhVH1NnUc7MzCSYLd8Yn
…72zesp-default-include

# Conflicts:
#	src/conformance/constants.ts

@somewhatabstract somewhatabstract left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@somewhatabstract
somewhatabstract merged commit 3d467ac into main Nov 11, 2026
15 checks passed
@somewhatabstract
somewhatabstract deleted the claude/jolly-galileo-72zesp-default-include branch November 11, 2026 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants