Strip all comments repo-wide, restore minimal public doc comments - #17
Merged
Conversation
scripts/stripcomments (go/parser + go/printer, comments never attached to the tree so the reprint has none) and scripts/CommentStripper (Roslyn syntax rewriter filtering comment/doc-comment trivia) are purpose-built for a full comment removal pass: unlike a line-based regex, both operate on the real parse tree, so string/rune/verbatim/ interpolated literals containing "//" or "/*" are never touched, and multi-line/doc comments are caught the same way single-line ones are. Verified on copies of the real tree: gofmt-clean output with go vet/ test passing unchanged, and a full dotnet build failing with only the expected CS1591s (missing public-API doc comments) confined to dotnet/Meowshell, the one project with GenerateDocumentationFile + TreatWarningsAsErrors. Kept in the repo as standing tools, not deleted after this pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YCNCCSHwUMAKkUiNBvw5Kf
Mechanical pass via scripts/stripcomments -- go/parser without ParseComments never attaches comments to the AST, so go/printer's reprint has none; the diff is purely subtractive plus gofmt's own realignment where a removed inline comment affected column alignment. go vet/test both pass unchanged. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YCNCCSHwUMAKkUiNBvw5Kf
…comments Mechanical pass via scripts/CommentStripper -- comment/doc-comment trivia removed via a Roslyn syntax rewriter, leaving string/verbatim/ interpolated/raw literals untouched. dotnet/Meowshell/Meowshell.csproj is the one project with GenerateDocumentationFile+TreatWarningsAsErrors, so every CS1591 the build then reported got a terse one-line <summary> restored -- just enough to satisfy the compiler for the public API surface (IntelliSense/NuGet package docs), nothing restated beyond what the signature can't already say. Confirmed a record's own summary alone (no per-property <param> tags needed) satisfies CS1591 for its compiler-synthesized properties/constructor. Every other project in the solution has neither property set, so their internal/private-only files (JobObject, MeowshellProcessControl, TailcatListener, etc.) needed no restoration at all. dotnet build/test both clean. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YCNCCSHwUMAKkUiNBvw5Kf
Meowshell.Tests, Meowshell.Demo, Meowshell.PackageTests, and Meowshell.AndroidProbe -- none of these set GenerateDocumentationFile or TreatWarningsAsErrors, so nothing needed restoring after the Roslyn-based strip; dotnet test confirmed clean beforehand. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YCNCCSHwUMAKkUiNBvw5Kf
The daemon migration earlier this session made TailcatSshSession a thin wrapper over MeowshellAgentConnection, not a separate process-per-session implementation -- the "each spawn their own process and their own full handshake" line grouping it with CpAsync/ ListFilesAsync was left over from before that change. Corrected to describe what's actually true now: only CpAsync/ListFilesAsync spawn a bare-tailcat one-shot process; TailcatSshSession already runs on the daemon but still opens its own dedicated connection per session, which is exactly what MeowshellAgentConnection lets a caller avoid by sharing one connection across operations. Cross-checked the rest of both READMEs (feature tables, method lists, option tables) against current source directly rather than by eye; no other drift found. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YCNCCSHwUMAKkUiNBvw5Kf
The Go comment-stripping pass dropped //go:build lines along with everything else -- syntactically they're line comments, but the toolchain reads them to decide which files compile for a given GOOS/GOARCH. "unix" isn't a real GOOS, so it has no implicit filename-based meaning the way "_windows.go" does; losing the explicit "//go:build unix" tag on exec_unix.go/keystage_unix.go/ shim_unix.go/sshagent_unix.go made them compile unconditionally everywhere, colliding with their _windows.go counterparts and breaking the windows build (caught by CI, not locally, since this sandbox never cross-compiled for windows during the stripping pass itself). Restored the five affected files' tags exactly as they were. Fixed scripts/stripcomments itself too, since it's a standing tool that will hit this same class of bug on any future rerun: it now scans each file's leading comment lines with go/build/constraint before stripping, and splices any real build tag back into the printed output. Verified against a fresh copy of the pre-strip originals (produces the identical, now-correct result) and confirmed idempotent against the current tree (a rerun changes nothing). GOOS=windows and GOOS=linux both build and vet clean now; go test still passes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YCNCCSHwUMAKkUiNBvw5Kf
A removed comment that was the first or last line of a block left an empty line directly inside the braces -- gofmt/Roslyn have no opinion on that shape (a blank line at the top or bottom of a block is valid either way), so nothing in the original stripping pass touched it. Cleaned up the 20 real instances across cmd/meowshell and dotnet/ (an empty catch block, functions that opened straight onto a blank line, etc.) -- confirmed with a scripted scan that zero remain and no double-blank-lines exist anywhere. Fixed both standing tools the same way, so a future rerun produces this directly instead of needing another manual pass: each now collapses a blank line immediately after an opening brace or immediately before a closing one, as a text-level pass after the comment-stripping AST transform. Verified against fresh copies of the pre-strip originals for both languages -- byte-identical to this commit's manually-cleaned result for every file that needed no doc- comment restoration (the Go tool's output matches for all 34 files; the C# tool's for the 20 files outside dotnet/Meowshell, where the other 16 differ only by the doc comments restored after the original stripping pass, which a raw re-strip would remove again). go vet/test and dotnet build/test both clean. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YCNCCSHwUMAKkUiNBvw5Kf
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.
Summary
Follow-up to #16: a full comment-removal pass across the code we own (
cmd/meowshelland all ofdotnet/, excluding the vendored.tailcat-src), on the premise that source comments drift out of sync with behavior over time and the code itself is the only documentation that can't go stale. Also documentsMeowshellSocksProxy's SOCKS5 UDP ASSOCIATE as a known upstream limitation, and exposesmeowshell envin C# asTailcatClient.GetEnvironmentAsync.scripts/stripcomments(Go) — parses withgo/parserwithoutparser.ParseComments, so comments never enter the AST, then reprints viago/printer. Preserves//go:build/// +buildconstraint lines specially (see below) since those aren't just prose.scripts/CommentStripper(C#) — a RoslynCSharpSyntaxRewriterthat filters comment/doc-comment trivia while leaving string/verbatim/interpolated/raw literal content untouched.dotnet/Meowshell/Meowshell.csprojis the only project withGenerateDocumentationFile+TreatWarningsAsErrors, so everyCS1591the build reported after stripping got a terse one-line<summary>back — just enough for the public API surface (IntelliSense/NuGet docs), nothing restated beyond what a signature can't already say. Confirmed a record's own summary alone (no per-property<param>tags) satisfies CS1591 for its compiler-synthesized members.//go:buildlines are syntactically comments but control conditional compilation.stripcomments's first pass dropped them along with everything else, which silently broke the Windows build (_unix.gofiles compiling unconditionally on every platform, colliding with their_windows.gocounterparts) — caught by this PR's own CI run, not locally. Fixed by scanning each file's leading comment lines withgo/build/constraintbefore stripping and splicing any real build tag back into the output; verified idempotent against the current tree and cross-compiled clean forwindows/linuxafterward.dotnet/README.mdhad one confirmed-stale line left over fromTailcatSshSession's migration onto the daemon in meowshell agent: a persistent, multiplexed SSH daemon with general-host support #16 (it no longer "spawns its own process and full handshake") — corrected, and the rest of both READMEs cross-checked against current source directly.Test plan
go vet ./... && go test ./...cleangofmt -lclean acrosscmd/meowshellandscripts/stripcommentsGOOS=windows go build/go vetandGOOS=linux go build/go vetboth clean (the actual regression this PR introduced and then fixed)dotnet build Meowshell.sln -c Release— 0 warnings, 0 errorsdotnet test Meowshell.sln -c Release— 107/107 passing🤖 Generated with Claude Code
https://claude.ai/code/session_01YCNCCSHwUMAKkUiNBvw5Kf
Generated by Claude Code