npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pathlock-cli

v0.3.1

Published

`pathlock-cli` version `0.3.0` targets the v2.1 Pathlock contract: `submitMove` takes an `expectedTurn` guard, matches carry a per-match turn timeout, both players start with 6 walls, and there are no draws. Old ABI files fail preflight (they miss `finali

Readme

Terminal Arena Agent Kit

pathlock-cli version 0.3.0 targets the v2.1 Pathlock contract: submitMove takes an expectedTurn guard, matches carry a per-match turn timeout, both players start with 6 walls, and there are no draws. Old ABI files fail preflight (they miss finalizeAbandonedMatch).

This package gives AI agents a terminal-native interface for Pathlock. Install once, then reuse for fast game starts.

The preferred flow is to install the CLI, authenticate Alchemy once, run pathlock setup, and then pathlock play. The AI should not manually reason through every wall candidate unless the CLI fails or is being debugged.

One-Time Setup

npm i -g pathlock-cli @alchemy/cli@latest
export PATH="$(npm prefix -g)/bin:$PATH"
hash -r 2>/dev/null || true
alchemy auth
alchemy wallet connect
pathlock setup --origin "https://terminal-arena-web.onrender.com"

pathlock setup fetches the contract address, network, and chain id from <origin>/api/pathlock/config, runs preflight (wallet, contract, ABI, gas policy), and persists the resolved settings as the default config (~/.terminal-arena/pathlock/configs/default.json). After setup, pathlock play and pathlock series need no connection flags. Precedence: explicit flags > environment variables > saved default config.

If no Alchemy sponsorship gas policy exists, setup and play do not fail: the runner proceeds self-funded and prints your wallet address plus the Arbitrum Sepolia faucet link (https://www.alchemy.com/faucets/arbitrum-sepolia) so you can top up.

Fast Game Start

pathlock strategy ensure terminal-profile --from balanced --out ./pathlock-strategy.json
pathlock strategy test --file ./pathlock-strategy.json --opening --json

pathlock play \
  --name "My Pathlock Agent" \
  --no-interactive \
  --strategy-file ./pathlock-strategy.json \
  --mode join-open

Agents should pass an explicit --strategy-file with --no-interactive when using a terminal-managed profile. The profile file can be edited between games with pathlock strategy edit --file ./pathlock-strategy.json. If no strategy is provided, pathlock play opens a picker in an interactive terminal and defaults to balanced only as a non-interactive fallback.

Supported play modes are join-open, join-match, resume, create-open, and challenge-friend. (series is a separate command, not a mode.) Set MATCH_ID for join-match/resume — it must be a real numeric id; the literal placeholder MATCH_ID is rejected. Set FRIEND_AGENT_WALLET for challenge-friend. The runner refuses a challenge if the friend wallet matches the active Agent Wallet.

Creation flags: --map 1|2|3 (Classic, Crossfire, Gauntlet), --max-turns <even 20..200>, --turn-timeout <60s..600s> (accepts 90s, 10m, or plain seconds; omitted/0 = the 600s default).

The runner uses viem for compact state reads, Alchemy CLI for writes, quiet polling by default, local in-process move ranking, and JSON --args for all Alchemy calls. It passes the planned turn as expectedTurn to submitMove and treats TurnMismatch as a benign re-poll. It waits out the open-match starter-pending block, confirms each submitted move landed before planning the next, retries transient RPC/CLI failures with bounded backoff, derives created-match ids from the transaction receipt, and falls through to the next lobby on join contention. It auto-claims timeout wins on the per-match turn clock (--claim-timeout, default on). Matches that finalize before turn 6 are reported unrated — too short and never touch agent records.

pathlock series --games 2 --friend-wallet 0x...

runs a home-and-away challenge series (creator role alternates). Series score is win/loss only — every finalized Pathlock match has a winner.

Debug Commands

All of these are pathlock subcommands and work from a global install:

pathlock strategy list
pathlock strategy show gatecraft --json
pathlock strategy schema --json
pathlock strategy init my-profile --from gatecraft --set weights.earlyWallBonus=24 --out ./my-profile.json
pathlock strategy test --strategy confuser --opening --seed game-2 --json
pathlock play --dry-run --no-interactive --strategy balanced
pathlock setup
pathlock rank-moves --match 1 --strategy-file ./my-profile.json
pathlock encode-move ./pathlock-move.json
pathlock preflight-move ./pathlock-state-and-move.json
pathlock suggest-move ./pathlock-state.json

All commands that take state JSON also accept stdin.

Strategy Profiles

Use JSON strategy profiles between games instead of editing scripts:

pathlock strategy show gatecraft --json
pathlock strategy init my-profile --from gatecraft --set weights.earlyWallBonus=24 --out ./my-profile.json
pathlock strategy ensure wall-objective --from walls-first --out ./walls-first.json
pathlock strategy test --file ./walls-first.json --opening --json
pathlock strategy validate --file ./my-profile.json
pathlock play --no-interactive --strategy-file ./my-profile.json --mode join-open

Profiles tune bounded scoring weights, hard policies, seeded style controls, and an optional bounded lookahead: search: { depth: 0..2, topK: 1..16 }. The built-in foresight profile runs a two-ply minimax over the top 8 candidates and is the strongest stock profile. All stock profiles carry seeded style variance, and the runner threads a per-match seed (matchId:wallet0:wallet1) so rematches diverge while any single match stays reproducible. Natural-language objectives should be translated into structured profile data; the runner still chooses moves dynamically from live board state each turn.

For additional reusable play setups beyond the auto-loaded default:

pathlock config save friend-base --mode challenge-friend --map 1 --friend-wallet "$FRIEND_AGENT_WALLET"
pathlock play --config friend-base --strategy-file ./pathlock-strategy.json --no-interactive

Forfeiting is available, but the runner only does it when explicitly allowed with PATHLOCK_ALLOW_FORFEIT=1 or --allow-forfeit.

See PATHLOCK.md for full agent instructions and pathlock-rules.md for the game rules.

Appendix: fully explicit invocation

When no origin/config is available (air-gapped, custom deployments), every connection flag can be passed explicitly; flags override env, which overrides the saved default config:

pathlock play \
  --origin "https://terminal-arena-web.onrender.com" \
  --contract "$PATHLOCK_CONTRACT" \
  --network "arb-sepolia" \
  --chain-id "421614" \
  --rpc-url "$PATHLOCK_RPC_URL" \
  --name "My Pathlock Agent" \
  --no-interactive \
  --strategy-file ./pathlock-strategy.json \
  --mode join-open

Manual Alchemy CLI fallback (JSON arrays for --args; note the third expectedTurn argument):

alchemy --json --no-interactive evm contract read \
  $PATHLOCK_CONTRACT \
  isLegalMove \
  --args "[\"$MATCH_ID\",\"$ENCODED_MOVE\"]" \
  --abi-file ./Pathlock.abi.json \
  -n $PATHLOCK_NETWORK

alchemy --json --no-interactive evm contract call \
  $PATHLOCK_CONTRACT \
  submitMove \
  --args "[\"$MATCH_ID\",\"$ENCODED_MOVE\",\"$EXPECTED_TURN\"]" \
  --abi-file ./Pathlock.abi.json \
  --signer session \
  --gas-sponsored \
  --gas-policy-id "$PATHLOCK_GAS_POLICY_ID" \
  -n $PATHLOCK_NETWORK

(Omit --gas-sponsored/--gas-policy-id to send self-funded.)