Skip to content

Commit b84c2f3

Browse files
authored
🔖 (release) [NO-ISSUE]: New release incoming: Signer SOL 1.6.2, Signer ETH 1.11.0, Context Module 1.14.0, Signer BTC 1.2.1, Transport Node HID 1.0.0, Ledger Wallet 0.2.0, DMK 1.1.0, DevTools UI 1.1.0, DevTools Core 1.1.0, DevTools Rozenite 0.1.0, DevTools Websocket Common 1.0.1, DevTools Websocket Connector 1.1.0 (#1306)
2 parents cca7db4 + 939f845 commit b84c2f3

File tree

460 files changed

+27570
-2959
lines changed

Some content is hidden

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

460 files changed

+27570
-2959
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@ledgerhq/device-management-kit-sample": patch
3+
---
4+
5+
Convert trusted-name name sources/types to strings in API output.
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# Create PR
2+
3+
Create a GitHub pull request with proper title, changeset, and all required elements.
4+
5+
## Prompt Variables
6+
7+
All variables are optional. The AI will auto-derive values from context and only prompt when necessary.
8+
9+
$TICKET
10+
11+
> (Optional) JIRA ticket or NO-ISSUE. Auto-extracted from branch name if present.
12+
13+
$EMOJI
14+
15+
> (Optional) Gitmoji emoji. Auto-selected based on diff contents.
16+
17+
$SCOPE
18+
19+
> (Optional) Package scope in lowercase. Auto-detected from changed files.
20+
21+
$DESCRIPTION
22+
23+
> (Optional) Short description. Auto-generated from diff analysis.
24+
25+
$DRAFT
26+
27+
> (Optional) Whether to create as draft PR. Defaults to true.
28+
29+
## Instructions
30+
31+
**Before starting**: Read [CONTRIBUTING.md](../../CONTRIBUTING.md) and [danger/helpers.ts](../../danger/helpers.ts) to understand the current validation rules for branches, commits, and PR titles.
32+
33+
### Step 1: Pre-flight checks
34+
35+
1. Check for uncommitted changes with `git status --porcelain`. If any exist, ask user whether to commit, stash, or abort.
36+
37+
2. Check if a PR already exists for this branch:
38+
39+
```bash
40+
gh pr view --json url,title,state 2>/dev/null
41+
```
42+
43+
If it exists, ask user whether to update it or abort.
44+
45+
3. Detect if this is a fork (forks have relaxed validation rules per CONTRIBUTING.md):
46+
```bash
47+
gh repo view --json isFork -q .isFork
48+
```
49+
50+
### Step 2: Check current branch state
51+
52+
1. Get current branch with `git branch --show-current`
53+
2. If on `develop` or `main`, ask user for a new branch name following the conventions in [CONTRIBUTING.md](../../CONTRIBUTING.md), then create it with `git checkout -b <branch-name>`
54+
3. Validate the branch name against the regex in [danger/helpers.ts](../../danger/helpers.ts). Do not skip this as a wrong branch name will force the user to close the PR and reopen a new one.
55+
4. Extract ticket from branch name (refer to danger/helpers.ts for the valid ticket patterns)
56+
57+
### Step 3: Analyze changes
58+
59+
1. Run `git fetch origin develop && git diff origin/develop...HEAD` to understand the changes (three dots to show only branch changes, not upstream changes)
60+
2. Run `git status` to see modified files
61+
3. Validate existing commit messages against the regex in [danger/helpers.ts](../../danger/helpers.ts):
62+
```bash
63+
git log origin/develop..HEAD --pretty=format:%s
64+
```
65+
If any commits don't match, warn the user they may need to amend commits before the PR can pass CI.
66+
4. Auto-derive:
67+
- **Scope**: from the most impacted package(s) under `packages/`
68+
- **Emoji**: run `pnpm gitmoji --list` and select the most appropriate one based on diff contents
69+
- **Description**: summarize the changes in a few words, starting with uppercase
70+
71+
### Step 4: Ask for missing info
72+
73+
1. If ticket was not extracted from branch name (and not a fork), ask the user for it
74+
2. Present the auto-derived values (emoji, scope, description) for confirmation
75+
3. Allow user to override any values if needed
76+
4. Ask if the PR should be created as draft (default: yes)
77+
78+
### Step 5: Verify changeset
79+
80+
1. Check if a changeset file exists in `.changeset/`
81+
2. If not, and the changes affect **published packages** (not apps or internal tooling), create one following [.cursor/rules/changeset.mdc](../rules/changeset.mdc)
82+
83+
> Note: Changesets are only required for published packages, not for apps or internal tooling (see CONTRIBUTING.md).
84+
85+
### Step 6: Stage and commit if needed
86+
87+
If there are changes after creating the changeset:
88+
89+
1. Stage the changes
90+
2. Create a commit following the format in [CONTRIBUTING.md](../../CONTRIBUTING.md)
91+
3. Validate the commit message against the regex in [danger/helpers.ts](../../danger/helpers.ts)
92+
93+
### Step 7: Run Danger validation (MANDATORY)
94+
95+
**This step is mandatory.** Run the local Danger checks to validate branch name, commit messages, and changesets before pushing:
96+
97+
```bash
98+
# For non-fork repositories
99+
pnpm danger:local
100+
101+
# For fork repositories (relaxed validation rules)
102+
pnpm danger:local:fork
103+
```
104+
105+
If any checks fail:
106+
107+
- **Branch name invalid**: Follow the dangerfile rules and suggest a new branch name. A wrong branch name will force closing the PR and reopening a new one. As long as this check is failing, DO NOT open the PR.
108+
- **Commit messages invalid**: Warn user they need to amend commits (e.g., `git rebase -i origin/develop`) before the PR can pass CI.
109+
- **Changeset missing**: Go back to Step 5 to create one if needed.
110+
111+
Do NOT proceed to push until all Danger checks pass.
112+
113+
### Step 8: Push branch
114+
115+
```bash
116+
git push -u origin HEAD
117+
```
118+
119+
### Step 9: Create or update PR
120+
121+
**Read [CONTRIBUTING.md](../../CONTRIBUTING.md) for the exact PR title format** (different for forks vs non-forks).
122+
123+
For the PR body, use the structure from [.github/pull_request_template.md](../../.github/pull_request_template.md) and fill in:
124+
125+
- Description based on diff analysis
126+
- Ticket link
127+
- Checklist: check "Changeset is provided" if one was created, otherwise add a note explaining why no changeset is needed (e.g., "No changeset needed - changes only affect apps/internal tooling")
128+
129+
Use `gh pr create` (or `gh pr edit` if updating):
130+
131+
```bash
132+
# Add --draft flag only if user chose draft mode
133+
gh pr create [--draft] --title "<TITLE>" --body "<BODY>"
134+
```
135+
136+
When updating an existing PR, ask the user if they want to update the body as well:
137+
138+
```bash
139+
gh pr edit --title "<TITLE>" --body "<BODY>"
140+
```
141+
142+
### Step 10: Output PR URL
143+
144+
After creating/updating the PR, output the URL in two formats (do NOT auto-open):
145+
146+
```
147+
PR created successfully!
148+
149+
URL: <PR_URL>
150+
151+
[<TITLE>](<PR_URL>)
152+
```
153+
154+
## Reference Files
155+
156+
- [CONTRIBUTING.md](../../CONTRIBUTING.md) - All conventions (branch naming, PR title format, commit format)
157+
- [danger/helpers.ts](../../danger/helpers.ts) - CI validation regexes (source of truth)
158+
- [.github/pull_request_template.md](../../.github/pull_request_template.md) - PR body template structure
159+
- [.cursor/rules/changeset.mdc](../rules/changeset.mdc) - Changeset creation guidelines
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Trigger Snapshot Release
2+
3+
Trigger the snapshot release workflow to build and publish snapshot packages from the current branch.
4+
5+
## Requirements
6+
7+
- **GitHub CLI (`gh`)** — Must be installed and authenticated (`gh auth login`)
8+
- **Git push access** — Write permissions to `LedgerHQ/device-sdk-ts`
9+
10+
## Prompt Variables
11+
12+
$TAG
13+
14+
> Optional: Snapshot version tag name (e.g., "my-feature"). Leave empty to use the branch name (with "/" replaced by "-").
15+
16+
## Instructions
17+
18+
Execute the following steps in order. Stop and report to the user if any step fails.
19+
20+
Throughout execution, collect any warnings (non-fatal issues) to include in the final output summary.
21+
22+
### 1. Get current branch
23+
24+
- Run: `git branch --show-current`
25+
- If the output is empty, the repo is in detached HEAD state. Stop and inform the user: "Cannot trigger snapshot release: not on a branch (detached HEAD state)"
26+
- Otherwise, store the branch name for later steps
27+
28+
### 2. Determine snapshot tag
29+
30+
- If `$TAG` is provided and non-empty:
31+
- Validate it contains only alphanumeric characters, hyphens (`-`), and underscores (`_`)
32+
- If invalid, stop and inform the user: "Invalid tag: only alphanumeric characters, hyphens, and underscores are allowed"
33+
- Use it as the snapshot tag
34+
- Otherwise, derive the tag from the branch name by replacing all `/` characters with `-` (e.g., `feat/my-feature` becomes `feat-my-feature`)
35+
36+
### 3. Check for uncommitted changes
37+
38+
- Run: `git status --porcelain`
39+
- If output is non-empty, **record a warning** (but continue): "Uncommitted changes won't be included in the snapshot"
40+
- Store this warning to include in the final output summary
41+
42+
### 4. Push branch to origin
43+
44+
- Run: `git push -u origin HEAD`
45+
- **If push fails**:
46+
- If the error indicates the remote branch has diverged (e.g., "rejected" or "non-fast-forward"), inform the user: "Push failed: remote branch has diverged. Run `git pull --rebase` to update your local branch, or use `git push --force` if you're sure you want to overwrite the remote."
47+
- For other errors (e.g., permission denied), stop and report the error to the user
48+
49+
### 5. Trigger the snapshot workflow
50+
51+
- Run: `gh workflow run "[Release] Snapshot Release" -f ref=<branch> -f tag=<snapshot_tag>`
52+
- `<branch>` is the branch name from step 1
53+
- `<snapshot_tag>` is the tag determined in step 2
54+
- **If the workflow trigger fails**, stop and report the error to the user
55+
56+
### 6. Get workflow run URL
57+
58+
- Wait 5 seconds for the workflow to be queued
59+
- Fetch the most recent pending or in-progress run: `gh run list --workflow=snapshot_release.yml --limit 5 --json url,name,status,createdAt`
60+
- Note: Do not use `--branch` filter — `workflow_dispatch` runs are associated with the default branch, not the `ref` input
61+
- Filter to runs with `status` of `"queued"`, `"in_progress"`, or `"pending"`
62+
- Take the most recently created run (by `createdAt` timestamp)
63+
- If the JSON output is an empty array `[]` or no matching run is found, retry up to 6 times with 5-second delays between attempts
64+
- Parse the JSON output and extract the `url`, `name`, and `status` fields
65+
66+
### 7. Estimate build time
67+
68+
- Fetch recent completed runs: `gh run list --workflow=snapshot_release.yml --status completed --limit 20 --json conclusion,createdAt,updatedAt`
69+
- Filter to successful runs only (`conclusion` = `"success"`)
70+
- Take up to 5 most recent successful runs
71+
- For each run, calculate duration in minutes: `(updatedAt - createdAt)` (both are ISO 8601 timestamps)
72+
- Calculate the average duration, rounded to the nearest minute
73+
- If no successful runs exist, note that build time cannot be estimated
74+
75+
## Output Format
76+
77+
After completing all steps, display the following summary:
78+
79+
---
80+
81+
**Snapshot release triggered**
82+
83+
- **Branch:** `<branch name>`
84+
- **Tag:** `<snapshot tag>`
85+
- **Workflow run:** [<run name> (<status>)](<run url>)
86+
- **Expected build time:** ~<average> minutes (based on up to 5 recent successful builds)
87+
- If no successful builds exist: "Unknown (no previous successful builds)"
88+
- **View all runs:** https://github.com/LedgerHQ/device-sdk-ts/actions/workflows/snapshot_release.yml
89+
90+
**Warnings:** (only include this section if there are warnings)
91+
92+
- List any warnings that occurred during execution, such as:
93+
- Uncommitted changes not included in the snapshot
94+
- Any other non-fatal issues encountered
95+
96+
---
97+
98+
## Workflow Reference
99+
100+
| Workflow Name | Workflow File | Description |
101+
| ---------------------------- | ---------------------- | -------------------------------------- |
102+
| `[Release] Snapshot Release` | `snapshot_release.yml` | Builds and publishes snapshot packages |
103+
104+
## Notes
105+
106+
- The snapshot workflow builds all packages from the specified branch and publishes them with the given tag
107+
- Packages are published to JFrog with the snapshot tag (e.g., `@ledgerhq/device-management-kit@0.0.0-feat-my-feature.1`)
108+
- The workflow runs on both public (for attestation) and private Ledger runners (for JFrog publishing)
109+
- The branch must exist on `LedgerHQ/device-sdk-ts` (origin)

‎.cursor/rules/commit.mdc‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,22 @@ Refer to these resources to help you select appropriate emojis and follow the co
5555
For more details or troubleshooting, see [CONTRIBUTING.md](https://github.com/LedgerHQ/device-sdk-ts/blob/develop/CONTRIBUTING.md).
5656

5757
Commits that don't follow this convention will fail CI and block merging.
58+
59+
### Signed commits
60+
61+
**All commits must be signed** to be merged into protected branches (`develop` and `main`). This is enforced by GitHub branch rulesets.
62+
63+
Make sure you have commit signing configured:
64+
65+
```bash
66+
git config --global commit.gpgsign true
67+
```
68+
69+
If you have unsigned commits, re-sign them before pushing:
70+
71+
```bash
72+
git rebase -i HEAD~N --exec "git commit --amend --no-edit -S"
73+
git push --force-with-lease
74+
```
75+
76+
See [CONTRIBUTING.md](https://github.com/LedgerHQ/device-sdk-ts/blob/develop/CONTRIBUTING.md#signed-commits) for setup instructions.

‎.github/actions/setup-with-cache-composite/action.yml‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,21 @@ runs:
66
steps:
77
- uses: moonrepo/setup-toolchain@v0
88

9-
- name: Install toolchain
9+
- name: Install toolchain and setup PATH
1010
shell: bash
11-
run: proto use
11+
run: |
12+
proto use
13+
# Get actual binary directories and add to PATH
14+
echo "$(dirname $(proto bin node))" >> $GITHUB_PATH
15+
echo "$(dirname $(proto bin pnpm))" >> $GITHUB_PATH
16+
echo "/home/runner/.proto/bin" >> $GITHUB_PATH
1217
1318
- name: Get pnpm store directory
1419
shell: bash
1520
run: |
16-
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
21+
echo "STORE_PATH=$(proto run pnpm -- store path --silent)" >> $GITHUB_ENV
1722
18-
- name: Restore pnpm cache
23+
- name: Setup pnpm cache
1924
uses: actions/cache@v4
2025
with:
2126
path: ${{ env.STORE_PATH }}
@@ -25,4 +30,4 @@ runs:
2530
2631
- name: Install dependencies
2732
shell: bash
28-
run: pnpm install
33+
run: proto run pnpm -- install

‎.prototools‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
node = "20.19.6"
2-
npm = "11.7.0"
3-
pnpm = "10.28.0"
1+
node = "20.20.0"
2+
npm = "11.8.0"
3+
pnpm = "10.28.2"

‎AGENTS.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# AI Agent Guidelines
2+
3+
AI agents contributing to this repository must follow project conventions.
4+
5+
## Description
6+
7+
The Device Management Kit (DMK) is a TypeScript library that provides easy communication with Ledger devices.
8+
9+
## Documentation
10+
11+
- [README.md](README.md)
12+
- [CONTRIBUTING.md](CONTRIBUTING.md) - Full contribution guidelines (branch naming, commits, PRs, changesets)
13+
14+
## Tools
15+
16+
- **proto** is used as the toolchain manager to install the right version of every tool.
17+
- **pnpm** is used as the package manager to install all the dependencies.
18+
- Use `gh` CLI (if available) for GitHub operations (create/update PRs, view workflows, comments, etc.)

0 commit comments

Comments
 (0)