Skip to content

feat: add npx claude-session CLI support - #1

Closed
yazins-ai wants to merge 6 commits into
ibrahimokdadov:masterfrom
yazins-ai:feat/npx-cli
Closed

feat: add npx claude-session CLI support#1
yazins-ai wants to merge 6 commits into
ibrahimokdadov:masterfrom
yazins-ai:feat/npx-cli

Conversation

@yazins-ai

Copy link
Copy Markdown

Summary

  • Adds bin/claude-session.js CLI entry point so the package can be run via npx claude-session
  • Adds bin and files fields to package.json for proper npm packaging
  • Auto-builds the frontend on first run if web/dist/ doesn't exist

Publishing to npm

Once merged, publish with:

# 1. Make sure "claude-session" isn't taken (it wasn't at time of PR)
npm view claude-session 2>/dev/null || echo "Name available!"

# 2. Login to npm (one-time)
npm login

# 3. Build the frontend so it ships pre-built
npm run build

# 4. Publish
npm publish

# 5. Users can now run it with:
npx claude-session

If the name claude-session is taken, you can scope it:

// package.json
"name": "@your-scope/claude-session"

Then users run: npx @your-scope/claude-session

Optional: pre-build on publish

Add a prepublishOnly script so the frontend is always built before publish:

"scripts": {
  "prepublishOnly": "vite build web/"
}

Test plan

  • npm pack and inspect tarball includes bin/, src/, web/, session-hook.js
  • npx . from the repo root starts the server and builds the frontend
  • After npm publish, npx claude-session works from any directory

yazinsai added 6 commits April 7, 2026 09:47
Adds a bin entry and CLI script so the package can be run directly
via `npx claude-session`. The CLI auto-builds the frontend on first
run if web/dist/ doesn't exist.
npx vite runs from an isolated temp directory that can't resolve
the project's dependencies. Install deps first, then use the
local node_modules/.bin/vite.
node_modules/.bin/vite doesn't work on Windows. Use
require.resolve('vite/bin/vite.js') which works everywhere.
The focus system (process tree walk, window activation, terminal
detection) was entirely Windows-only using PowerShell/WMI/Win32.

On macOS: walks process tree via `ps`, identifies terminal apps
(Warp, iTerm2, Terminal.app, kitty, etc.), and uses AppleScript
`osascript` to activate the window. Also fixes the terminals API
and guards the Windows-only startup process discovery.
@ibrahimokdadov

Copy link
Copy Markdown
Owner

Changes implemented directly in master (30cb880). Closing.

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.

3 participants