Add help50 integration - #196
Merged
Merged
Conversation
- codespace.sh: override help50's _helpful/_helpless/_helped hooks to relay to the help50 extension via command50, which shows a button in the terminal title bar that hands the message to the CS50 Duck; skip _helpless when the failed command produced no output (e.g., grep with no match) - codespace.sh: set WORKDIR to the workspace so help50's helpers can find misplaced files (cs50/cli defaults it to $HOME) - Dockerfile, devcontainer.json: build and install help50.vsix - devcontainer.json: add a Sysadmins terminal profile (sudo bash), which gets a root shell without help50
tests/smoke.sh runs the built image under timeouts: non-interactive login shells exit (help50 must not start without a terminal), the help50 hooks are the codespace overrides and behave, help50.vsix and command50 are present, and root shells have no help50. Run in CI after each build and before any push.
Branch builds use cs50/cli:amd64 (main), which doesn't have help50 yet, so codespace.sh errored on every login shell sourcing /opt/cs50/lib/cli. Guard the source, and have the smoke test skip the help50 checks (visibly) when the base image lacks them, while still asserting that login shells start cleanly.
This was referenced Sep 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wires the new
help50from cs50/cli#210 into the codespace, so a failed command in the terminal can hand its error to the CS50 Duck. Targetscanaryto test on the canary image.How it works
/etc/profile.d/help50.sh(from cs50/cli) runs after each command and calls one of three hooks.codespace.shnow overrides them:_helpful(a local helper had advice, e.g.1s-> "Did you meanls?"): prints the advice in the terminal as before, and shows a help50 button in the terminal title bar; clicking it has the duck say the same advice, so the student can follow up._helpless(no helper matched): prints "Clickhelp50above for help with that error" and shows the button; clicking it sends the output to cs50.ai for an explanation. Skipped when the command produced no output, sogrepwith no match,false, or a program exiting 1 stay quiet._helped(command succeeded): hides the button, only if one is showing.The button is the help50 extension (cs50/help50.vsix#1); the shell reaches it through
command50, the same bridgestyle50uses.command50runs detached with output discarded, so the prompt is never delayed and a missing extension server degrades silently.Other changes
WORKDIRis set to/workspaces/$RepositoryName. cs50/cli defaults it to$HOME, so help50's "Did you mean tocd foo/barfirst?" suggestions never fired in codespaces.help50.vsixis built into/opt/cs50/extensionsand installed like the other extensions.sudo bash) gives staff a root shell, which cs50/cli's profile skips entirely, so no help50.tests/smoke.shruns the built image under timeouts and is run in CI after each build, before any push: non-interactive login shells exit, the hooks are the codespace overrides and behave,help50.vsixandcommand50are present, root shells have no help50.Testing
Overlaid
codespace.shoncs50/cliwith a fakecommand50that logs its arguments and drove an interactive login shell under a pty.1s,python baz.pyfrom the wrong directory, andcat nothereproduced the expected inline text and exactly oneshowButtoncall each with the message intact;true/lsproduced onehideButtoneach;grepwith no match,false, anddiffproduced nothing.tests/smoke.shpasses on that image.Depends on the current default branches of cs50/help50.vsix and cs50/cs50.vsix (both merged today) and on
cs50/cli:canarycarrying thehelp50branch.