Repository navigation
Conversation
Add case-insensitive name and full-path predicates, AND combined filters, and bound traversal with validated depth limits. Expose the new options through find --help, the command catalogue, and reference docs. Amp-Thread-ID: https://ampcode.com/threads/T-ab5c38fa-df4f-4ded-b295-40513d6586bb Co-authored-by: Amp <amp@ampcode.com>
There was a problem hiding this comment.
🟡 Changes recommended
The path matcher changes character-class range membership for both -path and -ipath, producing false positives and false negatives that need correction and regression tests.
1 open issue
What changed in this PR
Extends the shell’s find command with common name, path, and depth filters to address OPE-99 while preserving alias traversal behavior.
Changes:
- Adds case-insensitive name and full-path matching, with AND semantics for repeated and combined predicates.
- Adds validated depth limits and traversal pruning.
- Updates help and documentation, with tests for filtering, depth boundaries, and option errors.
| File | Description |
|---|---|
pkg/shell/cmds/help.go |
Documents new filters and matching semantics in shell help. |
pkg/shell/cmds/find.go |
Implements predicates, depth limits, validation, and --help. |
pkg/shell/cmds/find_test.go |
Adds filtering, depth, validation, and help tests. |
docs/reference/commands.md |
Explains supported options and path/depth behavior. |
assets/lore/commands.md |
Updates the embedded command listing with new filters. |
Review effort: Balanced
| // find globs allow wildcards to match slashes. Map slashes | ||
| // to NUL (not a valid filename byte) on both sides so we can | ||
| // reuse path.Match without its separator restriction. | ||
| value = strings.ReplaceAll(value, "/", "\x00") |
There was a problem hiding this comment.
Confirmed and fixed in f174077. Added shell-level regressions for both reported cases under -path and -ipath; they failed with the original implementation. The replacement preserves all characters, handles separator-permissive * and ? directly, and delegates unchanged character classes and syntax validation to path.Match. Also covered negated ranges, Unicode, escaped brackets, and wildcard backtracking. Shell race tests, repository-wide short race tests, go vet, go build, formatting, and diff checks pass. New-head CI is subscribed.
Replace separator remapping with wildcard matching over unchanged characters. Reuse path.Match for syntax validation and character classes, and cover the review's false positive/negative cases for both path predicates. Amp-Thread-ID: https://ampcode.com/threads/T-ab5c38fa-df4f-4ded-b295-40513d6586bb Co-authored-by: Amp <amp@ampcode.com>

Linear issue
Fixes OPE-99.
Diagnosis
The shell's find parser only accepted -L, -name, and -type. It explicitly rejected common case-insensitive, full-path, and depth filters. A caller that discarded stderr and piped to head could mistake the rejected search for no matching files. Repeated name/type predicates also overwrote earlier filters instead of combining them.
Fix
Verification
All Go commands ran in the repository's Nix development shell.
Selection
Selected by Linear creation date, oldest first, among unresolved OpenLore bugs. Older issues skipped:
Agent thread
Implemented in this scheduled Amp child thread. The thread was labeled linear-auto-fix and the issue moved to In Progress with a thread-link comment before implementation.
Do not merge automatically.
Review correction
Reproduced the separator-remapping defect identified in review:
[.-0]Skillsmissed/Skills, while/Skills/[/-z]incorrectly matched/Skills/-, for both -path and -ipath. Replaced remapping with matching over unchanged characters. Regression coverage includes both examples, negated ranges, escaped brackets, Unicode, and wildcard backtracking. After this correction,go test -race ./pkg/shell/... -count=1,go test -race -short ./...,go vet ./...,go build ./..., gofmt, and diff checks passed. New-head CI is pending.