
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
cyrus-claude-parser
Advanced tools
A TypeScript parser for Claude's stdout JSON messages, designed to work with streamed output from the Claude CLI.
This package provides a robust parser for processing Claude's JSON output, handling:
This parser is designed to work with Claude's output that has been processed through jq -c .
. The jq
command:
claude [args] | jq -c .
The parser expects this compact JSON format where each line is a complete JSON object.
pnpm add @cyrus/claude-parser
import { StreamProcessor } from '@cyrus/claude-parser'
// Create a stream processor
const processor = new StreamProcessor({
sessionId: 'optional-session-id'
})
// Pipe Claude's stdout through jq to the processor
claudeProcess.stdout.pipe(processor)
// Handle parsed events
processor.on('data', (event) => {
console.log('Parsed event:', event)
})
processor.on('error', (error) => {
console.error('Parse error:', error)
})
import { StdoutParser } from '@cyrus/claude-parser'
const parser = new StdoutParser({
sessionId: 'optional-session-id'
})
// Listen for specific events
parser.on('assistant', (event) => {
console.log('Assistant message:', event.message)
})
parser.on('tool-use', (toolName, input) => {
console.log(`Tool ${toolName} called with:`, input)
})
parser.on('text', (text) => {
console.log('Text content:', text)
})
parser.on('error', (error) => {
console.error('Error:', error)
})
// Process data chunks
parser.processData(chunk)
// When done
parser.processEnd()
The parser emits the following events:
message
: Any Claude message (raw event)assistant
: Assistant messages with contentuser
: User messagessystem
: System initialization eventstool-use
: When Claude uses a tooltext
: Text content from assistant messagesend-turn
: When assistant finishes a turnresult
: Final result of the sessionerror
: Parse errors or Claude errorstoken-limit
: When token limit is detectedline
: Raw JSON lines (for debugging)All TypeScript types are exported from the package:
import type {
ClaudeEvent,
AssistantMessage,
UserMessage,
ToolUseContent,
ErrorEvent,
// ... and more
} from '@cyrus/claude-parser'
# Install dependencies
pnpm install
# Build
pnpm run build
# Run tests
pnpm test
# Watch mode
pnpm run dev
FAQs
Claude stdout JSON parser for Cyrus
We found that cyrus-claude-parser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.