Skip to content

Commit 789a00a

Browse files
authored
Merge pull request #412 from ckb-devrel/develop
Merge 0.4.5 into master
2 parents aa4735a + 24c954f commit 789a00a

137 files changed

Lines changed: 5054 additions & 38406 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.2/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "develop",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.eslintrc.js

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Changeset Check
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize, ready_for_review, labeled]
6+
branches: [master, develop]
7+
8+
jobs:
9+
verify:
10+
name: Verify Changeset
11+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-changeset') && !contains(github.event.pull_request.labels.*.name, 'dependencies') }}
12+
runs-on: ubuntu-latest
13+
permissions:
14+
pull-requests: write
15+
contents: read
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Setup pnpm
24+
uses: pnpm/action-setup@v4
25+
with:
26+
version: 10
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: '20'
32+
33+
- name: Install dependencies
34+
run: pnpm install --frozen-lockfile
35+
36+
- name: Check for changeset
37+
id: check
38+
run: |
39+
if pnpm changeset status --since=origin/${{ github.base_ref }}; then
40+
echo "has_changeset=true" >> $GITHUB_OUTPUT
41+
else
42+
echo "has_changeset=false" >> $GITHUB_OUTPUT
43+
exit 1
44+
fi
45+
46+
- name: Comment on PR (success)
47+
if: steps.check.outputs.has_changeset == 'true'
48+
uses: actions/github-script@v7
49+
with:
50+
script: |
51+
const marker = '<!-- changeset-check -->';
52+
const body = marker + '\n✅ Changeset file detected.';
53+
54+
const { data: comments } = await github.rest.issues.listComments({
55+
owner: context.repo.owner,
56+
repo: context.repo.repo,
57+
issue_number: context.issue.number
58+
});
59+
60+
const existing = comments.find(c => c.body.includes(marker));
61+
if (existing) {
62+
await github.rest.issues.updateComment({
63+
owner: context.repo.owner,
64+
repo: context.repo.repo,
65+
comment_id: existing.id,
66+
body
67+
});
68+
}
69+
70+
- name: Comment on PR (failure)
71+
if: failure()
72+
uses: actions/github-script@v7
73+
with:
74+
script: |
75+
const marker = '<!-- changeset-check -->';
76+
const body = [
77+
marker,
78+
'❌ **Missing Changeset**',
79+
'',
80+
'Please add a changeset describing your changes:',
81+
'```bash',
82+
'pnpm changeset',
83+
'```',
84+
'',
85+
'If your changes do not need a version bump (docs, CI, refactoring),',
86+
'add the `skip-changeset` label to this PR.',
87+
'',
88+
'For dependency updates, use the `dependencies` label.'
89+
].join('\n');
90+
91+
const { data: comments } = await github.rest.issues.listComments({
92+
owner: context.repo.owner,
93+
repo: context.repo.repo,
94+
issue_number: context.issue.number
95+
});
96+
97+
const existing = comments.find(c => c.body.includes(marker));
98+
if (existing) {
99+
await github.rest.issues.updateComment({
100+
owner: context.repo.owner,
101+
repo: context.repo.repo,
102+
comment_id: existing.id,
103+
body
104+
});
105+
} else {
106+
await github.rest.issues.createComment({
107+
owner: context.repo.owner,
108+
repo: context.repo.repo,
109+
issue_number: context.issue.number,
110+
body
111+
});
112+
}
113+
114+
skipped:
115+
name: Changeset Check (Skipped)
116+
if: ${{ contains(github.event.pull_request.labels.*.name, 'skip-changeset') || contains(github.event.pull_request.labels.*.name, 'dependencies') }}
117+
runs-on: ubuntu-latest
118+
steps:
119+
- run: echo "⏭️ Changeset check skipped via label"

.github/workflows/node.js.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,30 @@ jobs:
1616
- name: Checkout repository
1717
uses: actions/checkout@v4
1818

19+
- name: Setup pnpm
20+
uses: pnpm/action-setup@v4
21+
with:
22+
version: 10
23+
1924
- name: Setup Node.js
2025
uses: actions/setup-node@v4
2126
with:
2227
node-version: "20"
2328

29+
- name: Get pnpm store directory
30+
id: pnpm-cache
31+
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
32+
33+
- name: Cache pnpm store
34+
uses: actions/cache@v4
35+
with:
36+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
37+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
38+
restore-keys: |
39+
${{ runner.os }}-pnpm-store-
40+
2441
- name: Install dependencies
25-
run: npm install -g pnpm && pnpm i
42+
run: pnpm install --frozen-lockfile
2643

2744
- name: Linting
2845
run: pnpm lint

.github/workflows/publish.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ jobs:
2121
- name: Install dependencies
2222
run: npm install -g pnpm && pnpm i
2323

24+
- name: Verify changesets are consumed
25+
if: startsWith(github.ref, 'refs/tags/')
26+
run: |
27+
pnpm changeset version
28+
if ! git diff --quiet; then
29+
echo "Error: 'pnpm changeset version' produced uncommitted changes on a tag build."
30+
echo "Please run 'pnpm changeset version' locally, commit the resulting changes, and re-create the tag."
31+
git diff
32+
exit 1
33+
fi
34+
2435
- name: Build
2536
run: pnpm build
2637

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ jobs:
5050
- name: Install dependencies
5151
run: pnpm install --frozen-lockfile
5252

53-
- name: Run tests
54-
run: pnpm test
53+
- name: Run tests with coverage threshold
54+
run: pnpm test:ci
5555

5656
- name: Build project
5757
run: pnpm build

.husky/pre-commit

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env sh
2+
pnpm lint-staged
3+
pnpm typecheck

CHANGELOG.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# @offckb/cli
2+
3+
## 0.4.5
4+
5+
### Patch Changes
6+
7+
- 37189f7: fix(devnet): only show init hint for InitializationError
8+
9+
The `offckb devnet config` command was showing the "run `offckb node` once to initialize devnet config files first" hint for ALL errors, including user input errors like invalid `--set` syntax or validation failures.
10+
11+
Now the hint is only shown for actual initialization errors (missing config path, ckb.toml, or miner.toml), making error messages clearer and less misleading.
12+
13+
- Added `InitializationError` class to distinguish initialization errors from user input errors
14+
- Updated `createDevnetConfigEditor()` to throw `InitializationError` for missing files/paths
15+
- Modified `devnetConfig()` catch block to only show hint for `InitializationError`
16+
- Added type safety guard for error handling
17+
18+
Fixes #406
19+
20+
- e90cfe5: fix(ckb-debugger): lazy-load WASI module to suppress ExperimentalWarning
21+
22+
Convert static import of node:wasi to dynamic import with caching.
23+
This prevents the ExperimentalWarning from being emitted when running
24+
non-debugger commands like 'offckb accounts' or 'offckb config list'.
25+
26+
The WASI module is now only loaded when debugger functionality is
27+
actually executed.
28+
29+
Fixes #405
30+
31+
- 4a88eb6: fix(install): force x86_64 architecture on Windows
32+
33+
CKB only provides x86_64 binaries for Windows, not aarch64.
34+
When Windows ARM devices reported 'arm64' via os.arch(), the code
35+
tried to download a non-existent 'aarch64-pc-windows-msvc' binary,
36+
resulting in a 404 error.
37+
38+
This fix forces all Windows systems to use x86_64, which:
39+
40+
- Works correctly on Windows x64
41+
- Works via emulation on Windows ARM devices
42+
- Matches the only Windows binary CKB provides
43+
44+
## Changelog
45+
46+
All notable changes to this project will be documented in this file.
47+
This file is automatically updated by [changesets](https://github.com/changesets/changesets).

README.md

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,38 @@ offckb system-scripts --output <output-file-path>
276276

277277
By default, OffCKB use a fixed Devnet config. You can customize it, for example by modifying the default log level (`warn,ckb-script=debug`).
278278

279-
1. Locate your Devnet config folder:
280-
279+
1. Open the interactive Devnet config editor:
280+
281+
```sh
282+
offckb devnet config
283+
```
284+
285+
The editor uses a three-column layout: first-column file switcher (`ckb.toml` / `ckb-miner.toml`), a middle primary editing pane, and a smaller right read-only reference pane that shows the full built-in template for the currently selected file.
286+
287+
The left editing pane supports full key browsing/editing, including primitive value edits, object key add, array append/insert/move, search filter, and path delete.
288+
289+
Common shortcuts: `Enter` edit primitive, `a` add key/item, `i` insert array item, `m` move array item, `d` delete path, `/` search filter, `n`/`N` next/previous search match, `c` add custom value in fixed-array dialog (when allowed), `s` save, `q` quit.
290+
291+
Note: saving rewrites `ckb.toml` / `ckb-miner.toml` into canonical TOML format; upstream comments and original formatting are not preserved after save.
292+
293+
You can also update the same fields non-interactively (useful for scripts/CI):
294+
295+
```sh
296+
offckb devnet config --set ckb.logger.filter=info
297+
offckb devnet config --set ckb.rpc.enable_deprecated_rpc=true --set miner.client.poll_interval=1500
298+
```
299+
300+
If your terminal is non-interactive (no TTY, e.g. CI/remote pipeline), use `--set` mode directly instead of the full-screen editor.
301+
302+
1. Save changes and restart devnet:
303+
304+
```sh
305+
offckb clean -d
306+
offckb node
307+
```
308+
309+
1. (Advanced) Locate your Devnet config folder for manual edits:
310+
281311
```sh
282312
offckb config list
283313
```
@@ -293,12 +323,12 @@ Example result:
293323
}
294324
}
295325
```
326+
296327
Pay attention to the `devnet.configPath` and `devnet.dataPath`.
297-
298-
2. `cd` into the `devnet.configPath` . Modify the config files as needed. See [Custom Devnet Setup](https://docs.nervos.org/docs/node/run-devnet-node#custom-devnet-setup) and [Configure CKB](https://github.com/nervosnetwork/ckb/blob/develop/docs/configure.md) for details.
299-
3. After modifications, run `offckb clean -d` to remove the chain data if needed while keeping the updated config files.
300-
4. Restart local blockchain by running `offckb node`
301328

329+
1. `cd` into the `devnet.configPath` . Modify the config files as needed. See [Custom Devnet Setup](https://docs.nervos.org/docs/node/run-devnet-node#custom-devnet-setup) and [Configure CKB](https://github.com/nervosnetwork/ckb/blob/develop/docs/configure.md) for details.
330+
2. After modifications, run `offckb clean -d` to remove the chain data if needed while keeping the updated config files.
331+
3. Restart local blockchain by running `offckb node`
302332

303333
## Config Setting
304334

0 commit comments

Comments
 (0)