feat(terminal): wildcards expand as in bash 5.2; ls lists several operands like GNU ls - #419
Conversation
…rands like GNU ls The Linux and macOS terminals never expanded `*`, `?` or `[...]`: `rm *.txt` looked for a file named "*". parseArgs now keeps one flag per character (typed bare, or protected by quotes or a backslash) and expands words with an active wildcard against the files (src/app/data/commands/glob.ts): hidden files only for a pattern starting with a dot, never . or .., `*/` for folders, [!x] and [^x], sorted in the locale's order, a word with no match left as typed. PowerShell is untouched: its cmdlets read wildcards. ls with several operands now prints errors, then the files, then each folder under a "name:" header, as GNU ls does; -d lists folders themselves. Expected values: 40 globbing and 22 ls captures on Ubuntu 24.04 (bash 5.2.21, coreutils 9.4), 2 October 2026. code-reviewer: no confident finding; consecutive stars collapsed to limit backtracking. Phase 5d, lot 1, PR 2b. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Sorry @thierryvm, you've used your own review budget of 250,000 diff characters for the last 7 days.
You can request another review in 23 hours and 40 minutes by commenting @sourcery-ai review. Upgrade to get a review now.
Guide du reviewerIntroduit l’expansion des chemins d’accès de type shell Unix avant l’exécution des commandes, tout en préservant les sémantiques de guillemets et d’échappement et en laissant PowerShell inchangé, et met à jour Diagramme de séquence pour l’expansion des chemins Unix avant l’exécution des commandessequenceDiagram
participant User
participant Shell as UnixShell
participant Glob as expandGlob
participant FS as VirtualFileSystem
participant Command as UnixCommand
User->>Shell: Saisir une commande avec un joker actif
Shell->>Shell: parseArgs(input)
Shell->>Glob: expandGlob(word, meta, cwd, list)
Glob->>FS: Répertorier les entrées de répertoire correspondantes
FS-->>Glob: Fichiers et dossiers correspondants
Glob-->>Shell: Chemins triés selon la locale ou mot inchangé
Shell->>Command: Exécuter les arguments étendus
Diagramme de séquence pour
|
| Modification | Détails | Fichiers |
|---|---|---|
| Ajoute l’expansion des chemins compatible avec bash au processus d’analyse du shell Unix. |
|
src/app/data/commands/glob.tssrc/app/data/terminalEngine.tssrc/test/terminalEngine.test.ts |
Étend Unix ls afin de traiter plusieurs opérandes avec un regroupement et un formatage similaires à GNU. |
|
src/app/data/terminalEngine.tssrc/test/terminalEngine.test.ts |
| Met à jour la documentation destinée aux utilisateurs et la planification du projet afin de refléter le nouveau comportement du terminal. |
|
src/app/data/commandExamples.tsCHANGELOG.mdSTORY.mddocs/ROADMAP.mddocs/plan.md |
Conseils et commandes
Interagir avec Sourcery
- Déclencher une nouvelle revue : commentez
@sourcery-ai reviewsur la pull request. - Poursuivre les discussions : répondez directement aux commentaires de revue de Sourcery.
- Générer une issue GitHub à partir d’un commentaire de revue : demandez à Sourcery de créer une issue à partir d’un commentaire de revue en y répondant. Vous pouvez également répondre à un commentaire de revue avec
@sourcery-ai issuepour créer une issue à partir de celui-ci. - Générer un titre de pull request : écrivez
@sourcery-ain’importe où dans le titre de la pull request pour générer un titre à tout moment. Vous pouvez également commenter@sourcery-ai titlesur la pull request pour générer ou régénérer le titre à tout moment. - Générer un résumé de pull request : écrivez
@sourcery-ai summaryn’importe où dans le corps de la pull request pour générer un résumé exactement à l’endroit souhaité. Vous pouvez également commenter@sourcery-ai summarysur la pull request pour générer ou régénérer le résumé à tout moment. - Générer le guide du reviewer : commentez
@sourcery-ai guidesur la pull request pour générer ou régénérer le guide du reviewer à tout moment. - Résoudre tous les commentaires de Sourcery : commentez
@sourcery-ai resolvesur la pull request pour résoudre tous les commentaires de Sourcery. Utile si vous avez déjà traité tous les commentaires et ne souhaitez plus les voir. - Ignorer toutes les revues de Sourcery : commentez
@sourcery-ai dismisssur la pull request pour ignorer toutes les revues existantes de Sourcery. Particulièrement utile si vous souhaitez repartir de zéro avec une nouvelle revue : n’oubliez pas de commenter@sourcery-ai reviewpour déclencher une nouvelle revue !
Personnaliser votre expérience
Accédez à votre tableau de bord pour :
- Activer ou désactiver des fonctionnalités de revue telles que le résumé de pull request généré par Sourcery, le guide du reviewer, etc.
- Modifier la langue de la revue.
- Ajouter, supprimer ou modifier des consignes de revue personnalisées.
- Ajuster d’autres paramètres de revue.
Obtenir de l’aide
- Contactez notre équipe d’assistance pour toute question ou remarque.
- Consultez notre documentation pour accéder à des guides et informations détaillés.
- Restez en contact avec l’équipe Sourcery en nous suivant sur X/Twitter, LinkedIn ou GitHub.
Original review guide in English
Reviewer's Guide
Introduces Unix-shell pathname expansion before command execution, preserving quoting and escaping semantics while leaving PowerShell unchanged, and updates ls to format multiple file and directory operands like GNU ls. The PR adds focused globbing and ls regression coverage plus reference, changelog, and roadmap documentation.
Sequence diagram for Unix pathname expansion before command execution
sequenceDiagram
participant User
participant Shell as UnixShell
participant Glob as expandGlob
participant FS as VirtualFileSystem
participant Command as UnixCommand
User->>Shell: Enter command with active wildcard
Shell->>Shell: parseArgs(input)
Shell->>Glob: expandGlob(word, meta, cwd, list)
Glob->>FS: List matching directory entries
FS-->>Glob: Matching files and folders
Glob-->>Shell: Locale-sorted paths or unchanged word
Shell->>Command: Execute expanded arguments
Sequence diagram for GNU-style ls with multiple operands
sequenceDiagram
participant Shell as UnixShell
participant LS as cmdLs
participant FS as VirtualFileSystem
Shell->>LS: Execute ls with expanded operands
LS->>FS: Resolve each operand
FS-->>LS: Files, folders, and missing paths
LS->>LS: Collect errors, files, and directories
LS->>LS: Sort operand groups
LS-->>Shell: Errors first, files, directory headers, blank separators
Flow diagram for wildcard matching and literal preservation
flowchart TD
A[Unix command line] --> B{Wildcard active?}
B -->|No| C[Keep word literal]
B -->|Yes| D[expandGlob]
D --> E{Pattern matches?}
E -->|No| C
E -->|Yes| F[Filter hidden files and trailing-slash folders]
F --> G[Sort matches by locale]
G --> H[Pass expanded paths to command]
I[Quoted or escaped wildcard] --> C
File-Level Changes
| Change | Details | Files |
|---|---|---|
| Adds bash-compatible pathname expansion to the Unix shell parsing path. |
|
src/app/data/commands/glob.tssrc/app/data/terminalEngine.tssrc/test/terminalEngine.test.ts |
Extends Unix ls to process multiple operands with GNU-like grouping and formatting. |
|
src/app/data/terminalEngine.tssrc/test/terminalEngine.test.ts |
| Updates user-facing documentation and project planning to reflect the new terminal behavior. |
|
src/app/data/commandExamples.tsCHANGELOG.mdSTORY.mddocs/ROADMAP.mddocs/plan.md |
Tips and commands
Interacting with Sourcery
- Trigger a new review: Comment
@sourcery-ai reviewon the pull request. - Continue discussions: Reply directly to Sourcery's review comments.
- Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with@sourcery-ai issueto create an issue from it. - Generate a pull request title: Write
@sourcery-aianywhere in the pull
request title to generate a title at any time. You can also comment
@sourcery-ai titleon the pull request to (re-)generate the title at any time. - Generate a pull request summary: Write
@sourcery-ai summaryanywhere in
the pull request body to generate a PR summary at any time exactly where you
want it. You can also comment@sourcery-ai summaryon the pull request to
(re-)generate the summary at any time. - Generate reviewer's guide: Comment
@sourcery-ai guideon the pull
request to (re-)generate the reviewer's guide at any time. - Resolve all Sourcery comments: Comment
@sourcery-ai resolveon the
pull request to resolve all Sourcery comments. Useful if you've already
addressed all the comments and don't want to see them anymore. - Dismiss all Sourcery reviews: Comment
@sourcery-ai dismisson the pull
request to dismiss all existing Sourcery reviews. Especially useful if you
want to start fresh with a new review - don't forget to comment
@sourcery-ai reviewto trigger a new review!
Customizing Your Experience
Access your dashboard to:
- Enable or disable review features such as the Sourcery-generated pull request
summary, the reviewer's guide, and others. - Change the review language.
- Add, remove or edit custom review instructions.
- Adjust other review settings.
Getting Help
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.
…y operand A fidelity audit of PR #419 (573 commands against bash 5.2 and GNU coreutils 9.4 on Ubuntu) found that the new wildcards exposed commands that only handled their first operand. - Redirection targets are expanded like arguments on Linux/macOS: one match is used, none keeps the word, several give "ambiguous redirect" (also for `> $UNSET`); `> ""` is an error. - cd refuses more than one operand ("too many arguments"). - chmod, rm and mkdir process every operand and keep going after an error; rm gains -f/--force and drops the "(use -r)" suffix; mkdir errors use GNU's curly quotes (the PowerShell mapping accepts both). - head and tail: several files under "==> f <==" headers, the -N form, 0, +N and -N counts, GNU error messages. - ls: real option parsing (bundled letters, --all, --almost-all, --directory, --reverse, --classify, `--`), -A, -r, -F with -l, exit status 2 on an unreadable operand. - Wildcards: [:class:] inside brackets, a leading `]` is a member, `-` after a class is literal, an unknown class matches nothing. Expected values come from captures on Ubuntu 24.04. Remaining gaps are listed in docs/plan.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
This is Phase 5d, lot 1, PR 2b. The Linux and macOS terminals never expanded wildcards. Commands such as
ls documents/*orcat documents/*.mdlooked for a file literally named*.Pathname expansion, as bash 5.2 does it (new
src/app/data/commands/glob.ts):*,?,[...],[!x]and[^x]..and..never match.*/keeps folders only.ls *.txtgivescannot access '*.txt'.parseArgskeeps one flag per character, so wildcards in quotes, after a backslash, or inside a variable's value stay literal.lswith several operands now follows GNUls:name:header, separated by blank lines;-dlists the folders themselves;Reference page: a new
ls documents/*.mdexample explains that the shell replaces the star.Expected values come from captures on Ubuntu 24.04 (bash 5.2.21, coreutils 9.4): 40 for globbing and 22 for
ls.Checks
tsc, lint, 3057 tests and build all pass. The only failure is the flaky Supabase network integration test.feature-dev:code-reviewer: no confident finding. Its low-cost suggestion is applied: consecutive stars collapse into one.terminal-fidelity-auditor: 573 commands against bash 5.2 / coreutils 9.4. The glob core and multi-operandlsmatched. The audit found that wildcards exposed commands that only handled their first operand. These are fixed in the second commit, with expected values captured on Ubuntu:> documents/*.md; several matches giveambiguous redirect);cdwith several operands givestoo many arguments;chmod,rmandmkdirhandle every operand;headandtailprint several files under==>headers, and accept-N,+Nand0;lsreads-A,-r,-lF, long options and--, and exits with 2 on error;[[:class:]]works inside brackets.feature-dev:code-revieweron the fixes: no regression in Windows routing, unicode RegExp escapes, redirections or lesson validators. Its minor findings are fixed:tail -n 0/+N,head -n -N, thegraph/print/cntrlclasses,-after a class, and> ""./tmppaths,ls -lmetadata) or debt listed indocs/plan.md.Known debt (docs/plan.md): brace expansion, an unquoted
$VARholding*,[a\-z],//in globs,ls -R, locale order inls,#comments,chmod's confirmation line.🤖 Generated with Claude Code