feat(cli): add lanterna ps for process discovery#88
Merged
Conversation
Lists running Node.js processes Lanterna can attach to, with a colored TTY table or JSON output (auto-detected from stdout). Each entry exposes pid, runtime, attachMode (`cdp-ready` or `pid-attach`), command, cwd, ageMs, cpu and memory — so agents and scripts can discover an attachable PID before `lanterna attach --pid`. Refactors attach-target.ts so OS-process discovery and table rendering live in reusable modules (`node-process-discovery.ts`, `node-process-table.ts`) shared with the new command. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Updates the lanterna-profiler skill to drive PID discovery via the new `lanterna ps` command before attach: enumerates live node/nodejs runtimes, presents the candidates back, and asks the user to pick rather than choosing silently. Prefers `cdp-ready` targets and falls back to `run` or `--inspect-url` when the list is empty. Also refines two reference pages: clarifies `--heap-sample-interval` units in memory-profiling.md and elevates workload sourcing (already active vs. user-launched vs. agent-launched) to a primary question in workload-guidance.md. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
lanterna ps, a subcommand that lists live Node.js processes Lanterna can attach to (pid, runtime, attach mode, command, cwd, age, CPU, memory). Output auto-detects: colored table on a TTY, JSON when piped — so agents and scripts can discover an attachable PID beforelanterna attach --pid.attach-target.ts: OS-process discovery (node-process-discovery.ts) and table rendering (node-process-table.ts) move into reusable modules shared between the interactive picker and the new command.lanterna-profilerskill to drive PID discovery vialanterna ps --format jsonbefore attach (enumerate, present, ask — never pick silently). Also refines--heap-sample-intervalunits inmemory-profiling.mdand elevates workload sourcing to a primary question inworkload-guidance.md.Test plan
npm run typechecknpm test(531 tests across the 3 packages, including the newps.test.tsandnode-process-discovery.test.ts)npm run check(biome)lanterna pson a TTY → colored table sortedcdp-readyfirst, then by CPUlanterna ps | jq .→ JSON arraylanterna ps --format json --pretty→ pretty-printed JSON🤖 Generated with Claude Code