Skip to content

Strip all comments repo-wide, restore minimal public doc comments - #17

Merged
Sniperlyf3 merged 8 commits into
mainfrom
meowshell-agent-daemon
Sep 10, 2026
Merged

Strip all comments repo-wide, restore minimal public doc comments#17
Sniperlyf3 merged 8 commits into
mainfrom
meowshell-agent-daemon

Conversation

@Sniperlyf3

Copy link
Copy Markdown
Owner

Summary

Follow-up to #16: a full comment-removal pass across the code we own (cmd/meowshell and all of dotnet/, 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 documents MeowshellSocksProxy's SOCKS5 UDP ASSOCIATE as a known upstream limitation, and exposes meowshell env in C# as TailcatClient.GetEnvironmentAsync.

  • Two purpose-built stripping tools, kept in the repo as standing tools rather than one-off scripts:
    • scripts/stripcomments (Go) — parses with go/parser without parser.ParseComments, so comments never enter the AST, then reprints via go/printer. Preserves //go:build/// +build constraint lines specially (see below) since those aren't just prose.
    • scripts/CommentStripper (C#) — a Roslyn CSharpSyntaxRewriter that filters comment/doc-comment trivia while leaving string/verbatim/interpolated/raw literal content untouched.
    • Both operate on the real parse tree, not a line-based regex, so nothing inside a string literal is ever at risk.
  • Minimal doc-comment restoration: dotnet/Meowshell/Meowshell.csproj is the only project with GenerateDocumentationFile+TreatWarningsAsErrors, so every CS1591 the 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.
  • A real bug found and fixed in the Go tool itself: //go:build lines are syntactically comments but control conditional compilation. stripcomments's first pass dropped them along with everything else, which silently broke the Windows build (_unix.go files compiling unconditionally on every platform, colliding with their _windows.go counterparts) — caught by this PR's own CI run, not locally. Fixed by scanning each file's leading comment lines with go/build/constraint before stripping and splicing any real build tag back into the output; verified idempotent against the current tree and cross-compiled clean for windows/linux afterward.
  • README fix: dotnet/README.md had one confirmed-stale line left over from TailcatSshSession'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 ./... clean
  • gofmt -l clean across cmd/meowshell and scripts/stripcomments
  • GOOS=windows go build/go vet and GOOS=linux go build/go vet both clean (the actual regression this PR introduced and then fixed)
  • dotnet build Meowshell.sln -c Release — 0 warnings, 0 errors
  • dotnet test Meowshell.sln -c Release — 107/107 passing

🤖 Generated with Claude Code

https://claude.ai/code/session_01YCNCCSHwUMAKkUiNBvw5Kf


Generated by Claude Code

claude and others added 8 commits September 10, 2026 16:08
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
@Sniperlyf3
Sniperlyf3 merged commit 180ad36 into main Sep 10, 2026
18 checks passed
@Sniperlyf3
Sniperlyf3 deleted the meowshell-agent-daemon branch September 10, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants