fix(terminal): reference examples all run, and the engine matches real shells (THI-353) - #396
Conversation
…l shells (THI-353) Close the 32 /app/reference examples that still failed, checking every expected value against GNU bash, PowerShell 7, git and OpenSSH 10.5. - Engine: cat -n, grep -r, date +FORMAT, Get-Content -TotalCount/-Tail, Set-Content/Add-Content, Get-Date, Get-History, Get-Help, tasklist, Get-ScheduledTask, case-insensitive Select-String, PowerShell aliases routed to their cmdlets, $env:X += and Windows session variables. - Variables expand in parseArgs for every command (runSimple, runFilter), outside single quotes; \$, a leading ~, $1-$9, $PWD, and PowerShell $HOME/$PWD. Values are capped (H3) where they are stored and expanded. - ssh-keygen writes ~/.ssh keys (700/600/644); SHA-256 fingerprint and randomart identical to OpenSSH on real keys; -l prints it; getopt-style options; OpenSSH bounds and messages. - Fidelity fixes: Select-String without a match succeeds, empty git commit prints git's status and exits 1, Get-Help no longer shows bash syntax, git commit -am keeps its message, cherry-pick A..B, rebase bounds. - Lessons: Windows learners type Get-Help and Get-ScheduledTask (validateCron is env-aware), SSH shows OpenSSH's real dialogue and a Windows variant without ssh-copy-id, env-vars shows one shell per environment. - Ratchets: reference gaps 32 -> 0, theory gaps 160 -> 158, bash shown on Windows 37 -> 34. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
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 4 days and 20 hours by commenting @sourcery-ai review. Upgrade to get a review now.
Guide du reviewerLa PR clôt les 32 échecs restants de rejeu de référence en étendant le moteur de terminal avec les comportements Unix, PowerShell, Git et OpenSSH manquants, en centralisant l’expansion sécurisée des variables du shell et en reproduisant les sorties, statuts, fichiers et permissions d’un shell réel. Elle met également à jour le programme pédagogique et les validateurs spécifiques à Windows, ajoute une couverture étendue de fidélité et de régression, et documente les améliorations du mécanisme de progression. Diagramme de séquence pour l’expansion des variables PowerShell et l’exécution des cmdletssequenceDiagram
actor Learner
participant Engine
participant Parser as parseArgs
participant Cmdlet as PowerShell handler
participant FS as Terminal filesystem
Learner->>Engine: Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub
Engine->>Parser: parseArgs(command, expansionVars)
Parser-->>Engine: Expanded file path
Engine->>Cmdlet: handleWindows(Get-Content, args)
Cmdlet->>FS: readFile(path)
FS-->>Cmdlet: File content
Cmdlet-->>Engine: Output lines and status
Engine-->>Learner: PowerShell-compatible content
Diagramme de séquence pour la génération simulée d’une clé OpenSSHsequenceDiagram
actor Learner
participant Engine
participant Keygen as sshKeygen
participant FS as Terminal filesystem
participant Crypto as sha256 and randomart
Learner->>Engine: ssh-keygen -t ed25519 -C comment
Engine->>Keygen: keygenOptions(args)
Keygen->>Crypto: Generate public blob and fingerprint
Crypto-->>Keygen: SHA-256 fingerprint and randomart
Keygen->>FS: Create ~/.ssh and write private/public keys
FS-->>Keygen: Files with shell permissions
Keygen-->>Engine: OpenSSH dialogue and key metadata
Engine-->>Learner: Fingerprint, randomart, and saved paths
Learner->>Engine: ssh-keygen -l
Engine->>FS: Read public key
FS-->>Engine: Public key content
Engine-->>Learner: Matching fingerprint line
Diagramme de flux pour la validation des leçons tenant compte de l’environnementflowchart TD
Lesson[Lesson command] --> Environment{Terminal environment}
Environment -->|Linux or macOS| UnixCron[crontab -l]
Environment -->|Windows| WindowsTasks[Get-ScheduledTask]
UnixCron --> Validator[validateCron]
WindowsTasks --> Validator
Validator --> Result[Exercise validation result]
Modifications au niveau des fichiers
Conseils et commandesInteragir avec Sourcery
Personnaliser votre expérienceAccédez à votre tableau de bord pour :
Obtenir de l’aide
Original review guide in EnglishReviewer's GuideThe PR closes all 32 remaining reference replay failures by extending the terminal engine with missing Unix, PowerShell, Git, and OpenSSH behavior, centralizing safe shell-variable expansion, and matching real-shell output, statuses, files, and permissions. It also updates Windows-specific curriculum and validators, adds extensive fidelity/regression coverage, and documents the resulting ratchet improvements. Sequence diagram for PowerShell variable expansion and cmdlet executionsequenceDiagram
actor Learner
participant Engine
participant Parser as parseArgs
participant Cmdlet as PowerShell handler
participant FS as Terminal filesystem
Learner->>Engine: Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub
Engine->>Parser: parseArgs(command, expansionVars)
Parser-->>Engine: Expanded file path
Engine->>Cmdlet: handleWindows(Get-Content, args)
Cmdlet->>FS: readFile(path)
FS-->>Cmdlet: File content
Cmdlet-->>Engine: Output lines and status
Engine-->>Learner: PowerShell-compatible content
Sequence diagram for simulated OpenSSH key generationsequenceDiagram
actor Learner
participant Engine
participant Keygen as sshKeygen
participant FS as Terminal filesystem
participant Crypto as sha256 and randomart
Learner->>Engine: ssh-keygen -t ed25519 -C comment
Engine->>Keygen: keygenOptions(args)
Keygen->>Crypto: Generate public blob and fingerprint
Crypto-->>Keygen: SHA-256 fingerprint and randomart
Keygen->>FS: Create ~/.ssh and write private/public keys
FS-->>Keygen: Files with shell permissions
Keygen-->>Engine: OpenSSH dialogue and key metadata
Engine-->>Learner: Fingerprint, randomart, and saved paths
Learner->>Engine: ssh-keygen -l
Engine->>FS: Read public key
FS-->>Engine: Public key content
Engine-->>Learner: Matching fingerprint line
Flow diagram for environment-aware lesson validationflowchart TD
Lesson[Lesson command] --> Environment{Terminal environment}
Environment -->|Linux or macOS| UnixCron[crontab -l]
Environment -->|Windows| WindowsTasks[Get-ScheduledTask]
UnixCron --> Validator[validateCron]
WindowsTasks --> Validator
Validator --> Result[Exercise validation result]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
… button no longer hides keys (#397) Found in the visual check of #396 on mobile, tablet and desktop: - Lines laid out in columns (Get-Process, ps, ls -l, Get-History) are grouped by segmentOutput and shown unwrapped in TerminalColumns, which scrolls sideways with a right-edge fade and becomes a labelled focusable region only when it overflows. A lone line of names (ls, Tab completion) and git status entries keep wrapping. - Blank output lines keep their height (an empty div collapsed to nothing). - The touch key bar reserves its end for the AI tutor button, which covered the last keys (reserveKeyBarEnd, isAiTutorEnabled). - The terminal input stays 16px on touch screens (iPad Safari focus zoom). Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
Closes the last 32
/app/referenceexamples that failed in the practice terminal (THI-353 follow-up to #395). Every expected value in the new tests comes from a real shell run on 29 September 2026: GNU bash 5.3, PowerShell 7.6, git 2.56 and OpenSSH 10.5. None comes from the engine's own output.Engine
cat -n,grep -r,date +FORMAT(strftime),Get-Content -TotalCount/-Head/-Tail/-Raw,Set-Content,Add-Content,Get-Date -Format/-UFormat,Get-History,Get-Help,tasklist,Get-ScheduledTask.Select-Stringignores case and prefixesfile:line:.cat,typeandhistoryare routed to their cmdlets under PowerShell.$env:X +=works. Windows session variables are defined (USERNAME,USERPROFILE…).parseArgs, so it applies to every command (cd $HOME,Get-Content $env:USERPROFILE\...), not onlyecho.\$, a leading~,$1–$9and$PWDbehave as in bash.$HOMEand$PWDwork under PowerShell.cmdEchoandcmdExportno longer re-expand.export,$env:X =) and where they are expanded (H3 anti-flooding).ssh-keygenwrites real files:~/.ssh(700), private key (600),.pub(644,-Ccomment).-lprints the fingerprint again. Options are parsed getopt-style (-lf,-N "").parseArgskeeps an empty quoted word ("").Select-Stringwithout a match succeeds.git commitprints git's short status and exits 1.Get-Helpno longer shows the bash syntax line.git commit -amkeeps its message.cherry-pick A..Bis supported, andrebase -i HEAD~Nhas git's bounds.ssh-copy-idprints the missing INFO line.Lessons (
curriculum.ts)Get-Help Get-ChildItem.Get-ScheduledTask.crontabdoes not exist in PowerShell, andvalidateCronis now environment-aware.Enter file (.ssh/id_ed25519): [Entrée].ssh-copy-id, which Windows does not ship.Ratchets
KNOWN_THEORY_GAPS: 160 → 158.BASH_SHOWN_ON_WINDOWS_MAX: 37 → 34.Reviews
feature-dev:code-reviewer: 0 CRITICAL. All 5 IMPORTANT findings are fixed with tests:-t constructorcrash, unbounded-b,$env:Path = "$env:Path;…"wiping PATH, unbounded variable growth,-f <dir>replacing a folder. Most MINOR findings are fixed too.terminal-fidelity-auditor: the variable expansion, ssh-keygen, Select-String and empty-commit cases match the real shells. Its extra findings on this scope are fixed (\$,~,$HOMEon Windows,ssh-keygen -l, ssh-copy-id spacing).git addprinting text.Test plan
tsc --noEmit,eslint src,vitest run(2781 passed),vite buildnpm run theory:gapsregenerated (ratchets only went down)🤖 Generated with Claude Code
Résumé par Sourcery
Alignez le terminal d’entraînement et les leçons sur le comportement réel de bash, PowerShell, Git et OpenSSH afin que chaque exemple de référence s’exécute correctement.
Nouvelles fonctionnalités :
Corrections de bugs :
Améliorations :
Documentation :
Tests :
Original summary in English
Summary by Sourcery
Align the practice terminal and lessons with real bash, PowerShell, Git, and OpenSSH behavior so every reference example runs successfully.
New Features:
Bug Fixes:
Enhancements:
Documentation:
Tests: