Use inline :exclude in josh-proxy URL instead of stored filter files

The :+ stored filter syntax doesn't work in josh-proxy URLs.
Inline :exclude[::p1,::p2] works directly — no files to generate
or commit, no extra dependencies.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-14 10:19:41 +03:00
parent 5929585d6c
commit d7f8618b38
4 changed files with 9 additions and 80 deletions

View File

@@ -541,19 +541,13 @@ targets:
### How it works
When `exclude` is present, josh-sync generates a `.josh-filter-<target>.josh` file at the monorepo root containing a [josh stored filter](https://josh-project.github.io/josh/reference/filters.html) with `:exclude` clauses:
When `exclude` is present, josh-sync appends an inline `:exclude` filter to the josh-proxy URL. For the example above, the josh filter becomes:
```
:/services/billing:exclude[
::.monorepo/
::**/internal/
::*.secret
]
:/services/billing:exclude[::.monorepo/,::**/internal/,::*.secret]
```
The file is referenced in the josh-proxy URL as `:+.josh-filter-<target>` (flat naming — josh-proxy's parser treats `/` in `:+` paths as a filter separator, so subdirectory paths don't work).
Josh-proxy reads this file from the monorepo and applies the filter at the transport layer. This means:
Josh-proxy applies this filter at the transport layer — no extra files to generate or commit. This means:
- **Forward sync**: the filtered clone already excludes the files
- **Reverse sync**: pushes through josh also respect the exclusion
- **Reset**: the subrepo history never contains excluded files
@@ -574,11 +568,10 @@ Josh uses `::` patterns inside `:exclude[...]`:
### Setup
1. Add `exclude` to the target in `.josh-sync.yml`
2. Run `josh-sync preflight` — this generates `.josh-filter-<target>.josh`
3. Commit the generated file: `git add .josh-filter-*.josh && git commit`
4. Forward sync will now exclude the specified files
2. Run `josh-sync preflight` to verify the filter works
3. Forward sync will now exclude the specified files
If you change the `exclude` list, re-run `preflight` and commit the updated `.josh-filter-*.josh` file.
No extra files to generate or commit the exclusion is embedded directly in the josh-proxy URL.
## Adding a New Target