Skip to content

docs: Add documentation for adding new features#302

Merged
tvpeter merged 1 commit into
bitcoindevkit:masterfrom
tvpeter:docs/adding-a-feature
Jul 22, 2026
Merged

docs: Add documentation for adding new features#302
tvpeter merged 1 commit into
bitcoindevkit:masterfrom
tvpeter:docs/adding-a-feature

Conversation

@tvpeter

@tvpeter tvpeter commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Description

With the introduction of modular design architecture in the app (PR #278) , new contributors may find it challenging adding new features/commands. This PR adds a documentation section to provide them with an easy-to-follow guide.

Fixes #298

Changelog notice

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

@tvpeter tvpeter self-assigned this Jul 14, 2026
@tvpeter tvpeter added this to the CLI 4.0.0 milestone Jul 14, 2026
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.45%. Comparing base (b0e6a3c) to head (7e4a0ca).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #302   +/-   ##
=======================================
  Coverage   57.45%   57.45%           
=======================================
  Files          22       22           
  Lines        3695     3695           
=======================================
  Hits         2123     2123           
  Misses       1572     1572           
Flag Coverage Δ
rust 57.45% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tvpeter
tvpeter force-pushed the docs/adding-a-feature branch from 7391aad to 14c34d6 Compare July 18, 2026 00:23
Comment thread NEW_FEATURE.md Outdated
Comment on lines +88 to +90
fn execute(&self, contex: &mut AppContext<OfflineOperations<'_>>) -> Result<Self::Output, Error> {
// Access the loaded wallet via the context state
let wallet = &contex.state.wallet;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Is the contex parameter here a typo or intentional?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo. Fixed. Thank you

@tvpeter
tvpeter force-pushed the docs/adding-a-feature branch from 14c34d6 to 8f27808 Compare July 19, 2026 03:30

@va-an va-an left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK 8f27808

One thing worth fixing before merge - the Step 3 example doesn't compile as-is - the imports don't resolve (details inline).

Comment thread NEW_FEATURE.md Outdated
Comment on lines +79 to +81
use crate::context::{AppContext, OfflineOperations};
use crate::commands::AppCommand;
use crate::error::Error;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied the guide's snippets (Steps 1-3) into a single module and ran cargo check - the imports in Step 3 don't resolve:

error[E0432]: unresolved import `crate::context`
   |            ^^^^^^^ could not find `context` in the crate root
error[E0432]: unresolved import `crate::commands::AppCommand`
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `AppCommand` in `commands`
error[E0603]: derive macro import `Error` is private

There's no context module; AppContext/OfflineOperations/AppCommand all live in crate::handlers, and crate::error::Error resolves to thiserror's private derive macro rather than the error type (which is BDKCliError). The paths the real handlers use:

use crate::handlers::{AppCommand, AppContext, OfflineOperations};
use crate::error::BDKCliError as Error;

Comment thread NEW_FEATURE.md Outdated

## Adding a command/feature in bdk-cli

The modular architectural redesign (PR #278) introduced a strict separation of concerns and utilizes a Typestate Pattern to prevent invalid operations. If you are a new contributor looking to add a new command or feature, this guide will walk you through the process step-by-step.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor doc-style suggestion: since this is a reference guide for the current architecture, describing the design as it is now (rather than "PR #278 introduced ...") would age better. The #278 link still works as background, e.g. "(see #278 for the original design discussion)".

@tvpeter
tvpeter force-pushed the docs/adding-a-feature branch from 8f27808 to 7e4a0ca Compare July 20, 2026 12:41

@va-an va-an left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 7e4a0ca

@tvpeter
tvpeter merged commit ebf50f4 into bitcoindevkit:master Jul 22, 2026
9 checks passed
@github-project-automation github-project-automation Bot moved this to Done in BDK-CLI Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add a section in the README that explains how to add new features to the new design.

3 participants