Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/brave-falcons-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@offckb/cli": patch
---

Add daemon mode and structured JSON output for agent-friendly usage, plus a `node stop` command to terminate the daemon.

- `offckb node --daemon` starts the CKB devnet as a detached background process and writes the PID and logs to the devnet data folder.
- `offckb --json <command>` emits structured JSON log output for programmatic consumption.
- `offckb node stop` reads the daemon PID file and gracefully shuts down the daemon, falling back to force-kill if necessary. It now verifies the target process identity, handles stale PID files, and cleans up on error paths.
- Hardened daemon lifecycle: duplicate daemon starts are rejected, CLI entry resolution supports packaged/npx environments via `OFFCKB_CLI_PATH`, and log/PID directory creation failures are handled gracefully.
14 changes: 14 additions & 0 deletions .changeset/fix-dependabot-alerts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"@offckb/cli": patch
---

Resolve Dependabot security alerts via pnpm overrides for transitive dependencies:

- `qs` 6.15.0 → 6.15.2
- `ip-address` 10.1.0 → 10.1.1
- `js-yaml` 3.14.2 → 3.15.0 / 4.1.1 → 4.2.0
- `@babel/core` 7.28.6 → 7.29.7
- `@eslint/plugin-kit` 0.2.8 → 0.3.4
- `brace-expansion` 5.0.5 → 5.0.6

`elliptic` remains unfixed because a patched version (>=6.6.2) is not yet published on npm.
5 changes: 5 additions & 0 deletions .changeset/integrate-ckb-tui.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@offckb/cli": minor
---

Add `status` command to launch ckb-tui for monitoring CKB network from your node
5 changes: 5 additions & 0 deletions .changeset/tasty-walls-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@offckb/cli": minor
---

Refactor UDT CLI support: reuse `balance` and `transfer` commands for CKB and UDT queries, and add `offckb udt issue` / `offckb udt destroy` subcommands.
9 changes: 0 additions & 9 deletions .changeset/wise-candies-stop.md

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/changeset-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
fi

- name: Comment on PR (success)
if: steps.check.outputs.has_changeset == 'true'
if: steps.check.outputs.has_changeset == 'true' && !github.event.pull_request.head.repo.fork
uses: actions/github-script@v7
with:
script: |
Expand All @@ -68,7 +68,7 @@ jobs:
}

- name: Comment on PR (failure)
if: failure()
if: failure() && !github.event.pull_request.head.repo.fork
uses: actions/github-script@v7
with:
script: |
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# @offckb/cli

## 0.4.8

### Patch Changes

- Override `form-data@>=4.0.0 <4.0.6` to `4.0.6` to fix CRLF injection (GHSA).
- Override `hono@<4.12.25` to `4.12.25` to fix CORS origin reflection with credentials.

## 0.4.7

### Patch Changes

- 1c17600: Bump @ckb-ccc/core to 1.14.0 to fix the ws vulnerability (ws >= 8.21.0).
- a687c6f: Bump default CKB version to 0.207.0
- 3da9777: Replace ckb-transaction-dumper with ccc-based implementation

- Rewrite transaction dumper to use ccc Client and molecule codecs
- Implement dep_group unpacking using ccc.mol
- Remove ckb-transaction-dumper npm dependency

## 0.4.6

### Patch Changes
Expand Down
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Options:

Commands:
node [CKB-Version] Use the CKB to start devnet
node stop Stop the running CKB devnet daemon
create [options] [project-name] Create a new CKB Smart Contract project in JavaScript.
deploy [options] Deploy contracts to different networks, only supports devnet and testnet
debug [options] Quickly debug transaction with tx-hash
Expand All @@ -81,6 +82,7 @@ Commands:
transfer-all [options] [toAddress] Transfer All CKB tokens to address, only devnet and testnet
balance [options] [toAddress] Check account balance, only devnet and testnet
debugger Port of the raw CKB Standalone Debugger
status [options] Show ckb-tui status interface
config <action> [item] [value] do a configuration action
help [command] display help for command
```
Expand Down Expand Up @@ -118,6 +120,40 @@ offckb node --binary-path /path/to/your/ckb/binary

When using `--binary-path`, it will ignore the specified version and network, and only work for devnet.

**Run in Daemon Mode**

Start the devnet in the background so your terminal stays free:

```sh
offckb node --daemon
```

The daemon writes its logs and PID to the devnet data folder, for example:

- Logs: `~/Library/Application Support/offckb-nodejs/devnet/data/logs/daemon.log`
- PID file: `~/Library/Application Support/offckb-nodejs/devnet/data/logs/daemon.pid`

Stop the daemon later with:

```sh
offckb node stop
```

**Agent-Friendly JSON Output**

For programmatic consumption or agent integration, add `--json` to any command to emit structured JSON logs:

```sh
offckb node --json
offckb node --daemon --json
```

Each log line is a single JSON object:

```json
{"level":"info","message":"Launching CKB devnet Node...","timestamp":"2026-07-07T07:10:00.000Z"}
```

**RPC & Proxy RPC**

When the Devnet starts:
Expand All @@ -134,6 +170,10 @@ offckb node --network <testnet or mainnet>
```
Using a proxy RPC server for Testnet/Mainnet is especially helpful for debugging transactions, since failed transactions are dumped automatically.

**Watch Network with TUI**

Once you start the CKB Node, you can use `offckb status --network devnet/testnet/mainnet` to start a CKB-TUI interface to monitor the CKB network from your node.

### 2. Create a New Contract Project {#create-project}

Generate a ready-to-use smart-contract project in JS/TS using templates:
Expand Down
9 changes: 2 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@offckb/cli",
"version": "0.4.6",
"version": "0.4.8",
"description": "ckb development network for your first try",
"author": "CKB EcoFund",
"license": "MIT",
Expand All @@ -25,11 +25,6 @@
"publishConfig": {
"access": "public"
},
"pnpm": {
"onlyBuiltDependencies": [
"secp256k1"
]
},
"scripts": {
"build": "node scripts/build.js",
"start": "ts-node-dev --transpile-only src/cli.ts",
Expand Down Expand Up @@ -78,7 +73,7 @@
"typescript": "^5.3.3"
},
"dependencies": {
"@ckb-ccc/core": "1.5.3",
"@ckb-ccc/core": "1.14.0",
"@iarna/toml": "^2.2.5",
"@inquirer/prompts": "^7.8.6",
"@types/http-proxy": "^1.17.15",
Expand Down
Loading
Loading