Skip to content

chore: add changeset#5

Merged
mehdiasadli merged 5 commits intomainfrom
feat/cli
Feb 10, 2026
Merged

chore: add changeset#5
mehdiasadli merged 5 commits intomainfrom
feat/cli

Conversation

@mehdiasadli
Copy link
Copy Markdown
Contributor

@mehdiasadli mehdiasadli commented Feb 10, 2026

Description

Add a CLI that allows running .push files directly via the pushkin command

Type of Change

  • feat: New language feature

Changes Made

  • Add src/cli.ts — reads a .push file from command line arguments and runs it through the lexer, parser, and interpreter
  • Update tsup.config.ts — separate build config for library and CLI entry, with shebang banner for CLI
  • Add bin field to package.json — registers pushkin as a global command
  • Add example .push programs in examples/

How to Test

  • bun run build
  • node dist/cli.js examples/hello.push → should print 30
  • node dist/cli.js examples/arithmetic.push → should print 142, 58, 27
  • node dist/cli.js examples/swap.push → should print 10, 20, 20, 10
  • Run with no args: node dist/cli.js → should show usage message
  • Run with non-.push file: node dist/cli.js foo.txt → should show error

Checklist

  • Code follows the project's style (Biome passes)
  • Tests added/updated for the changes
  • Build passes (bun run build)
  • Changeset added (if this affects the published package)

Related Issues

Closes #

Summary by CodeRabbit

  • New Features

    • Added a CLI command to execute .push files directly from the command line.
  • Chores

    • Updated build configuration to support the new CLI capability.

@github-actions github-actions Bot added the docs label Feb 10, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 10, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR adds a CLI capability to the Pushkin package, enabling users to execute .push files directly from the command line. It introduces a new CLI entry point via package.json, implements the CLI logic in src/cli.ts, updates the build configuration to support dual builds (library and CLI), removes an example file, and documents the changes in a changeset.

Changes

Cohort / File(s) Summary
Build & CLI Configuration
package.json, tsup.config.ts
Added bin field to expose pushkin CLI command and updated build config from single to dual configuration objects to support both library and CLI builds with Node shebang.
CLI Implementation
src/cli.ts
New file implementing a complete CLI that reads a .push file, tokenizes via Lexer, parses via Parser, interprets the AST, and handles errors with appropriate exit codes.
Documentation & Examples
.changeset/short-kids-decide.md, examples/hello.push
Added changeset documenting minor version bump and new CLI feature; deleted the hello.push example file.

Sequence Diagram

sequenceDiagram
    participant User as User/Terminal
    participant CLI as CLI Handler
    participant FileSystem as File System
    participant Lexer
    participant Parser
    participant Interpreter

    User->>CLI: pushkin script.push
    CLI->>FileSystem: Read file
    FileSystem-->>CLI: File contents
    CLI->>Lexer: Tokenize contents
    Lexer-->>CLI: Token stream
    CLI->>Parser: Parse tokens
    Parser-->>CLI: AST
    CLI->>Interpreter: Execute AST
    Interpreter-->>CLI: Results
    CLI-->>User: Output/Exit code
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A CLI springs forth, so quick and spry,
With .push files executed on the fly,
From tokenize to parse to interpret's call,
The pushkin command conquers all!

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/cli

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mehdiasadli mehdiasadli self-assigned this Feb 10, 2026
@mehdiasadli mehdiasadli merged commit 76e916b into main Feb 10, 2026
4 of 5 checks passed
@mehdiasadli mehdiasadli deleted the feat/cli branch February 10, 2026 06:00
@github-actions github-actions Bot mentioned this pull request Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant