I’m stuck on Stage #WT6.
I’ve tried ..
much debugging. I’ve written a more extensive matcher to match the least common prefix for a set of given items. This works locally but does not pass on tests.
Git repo available here: GitHub - jgdovin/codecrafters-shell-javascript: progress for build your own shell from codecrafters.
Set up a similar test in my local environment:
codecrafters-shell-javascript (master) ✗ ./your_program.sh
$ xyz_
xyz_foo xyz_foo_bar xyz_foo_bar_baz
$ xyz_foo
xyz_foo_bar xyz_foo_bar_baz
$ xyz_foo_bar
below is a gif of it seeming to work as I expect on my local.

And here’s the logs of my tests:
Running tests. Logs should appear shortly...
[compile] Moved ./.codecrafters/run.sh → ./your_program.sh
[compile] Compilation successful.
[tester::#WT6] Running tests for Stage #WT6 (Autocompletion - Partial completions)
[tester::#WT6] [setup] export PATH=/tmp/qux:$PATH
[tester::#WT6] [setup] export PATH=/tmp/bar:$PATH
[tester::#WT6] [setup] export PATH=/tmp/baz:$PATH
[tester::#WT6] [setup] Available executables:
[tester::#WT6] [setup] - xyz_foo
[tester::#WT6] [setup] - xyz_foo_bar
[tester::#WT6] [setup] - xyz_foo_bar_quz
[tester::#WT6] Running ./your_program.sh
[tester::#WT6] ✓ Received prompt ($ )
[tester::#WT6] Typed "xyz_"
[tester::#WT6] ✓ Prompt line matches "$ xyz_"
[tester::#WT6] Pressed "<TAB>" (expecting autocomplete to "xyz_foo")
[your-program] $ xyz_
[tester::#WT6] ^ Line does not match expected value.
[tester::#WT6] Expected: "$ xyz_foo"
[tester::#WT6] Received: "$ xyz_"
[your-program] xyz_foo xyz_foo_bar xyz_foo_bar_quz
[your-program] $ xyz_foo
[tester::#WT6] Assertion failed.
[tester::#WT6] Test failed (try setting 'debug: true' in your codecrafters.yml to see more details)

