Skip to content

feat: extract tapp-cli into standalone crate (macOS compatible)#13

Closed
Wilbert957 wants to merge 2 commits into
0gfoundation:mainfrom
Wilbert957:feat/standalone-tapp-cli
Closed

feat: extract tapp-cli into standalone crate (macOS compatible)#13
Wilbert957 wants to merge 2 commits into
0gfoundation:mainfrom
Wilbert957:feat/standalone-tapp-cli

Conversation

@Wilbert957

Copy link
Copy Markdown
Collaborator

Summary

Extracts tapp-cli from tapp-service into its own workspace member crate, fully decoupled from TEE attestation dependencies that prevent compilation on macOS.

Problem

tapp-cli was a binary target inside tapp-service, sharing its full dependency tree including:

  • attestation-agent (TDX/SGX/SNP/CCA/CSV attesters — Linux kernel interfaces)
  • bollard (Docker client)
  • ecies (OpenSSL dependency)
  • sysinfo / psutil

These make cargo build fail on macOS. However, tapp-cli only needs ethers, clap, tonic, and k256 — none of the TEE/Docker stack.

Changes

  • Add tapp-cli/ as a workspace member with minimal Cargo.toml
  • Pre-generate proto Rust code (src/proto_gen.rs) to eliminate build-time protoc dependency
  • Copy only needed modules: onchain, app_key (sign/verify only), error
  • Remove tapp-cli binary target from tapp-service Cargo.toml
  • Includes fix/cli-short-flag-collisions changes

Testing

  • cargo build succeeds (0 errors, 4 pre-existing warnings)
  • ✅ All 32 subcommands --help work correctly
  • sign-message / verify-signature functional test passed
  • ✅ No protoc, OpenSSL, or Docker needed at build time

On macOS, simply:

cd tapp-cli && cargo build --release
./target/release/tapp-cli --help

Wilbert957 and others added 2 commits June 23, 2026 18:45
Several subcommand args used `#[arg(short, long)]`, auto-deriving a short flag that
collided with the global `--server` (-s) / per-command duplicates — clap's debug
assert panicked at startup (e.g. `register-onchain` couldn't run at all in debug
builds; release builds parsed ambiguously). The colliding shorts never worked, so
dropping them (keeping the `--long` forms, which all docs/examples already use) is a
pure fix.

Made long-only: `service`, `service_name`, `signature`, `chain_id`, `stake_wei`
(all auto-derived `-s`/`-c` clashing with `--server`/`--contract`); `recipient`
(explicit `-r` clashing with `--rpc-url` in withdraw-balance).

Verified: every subcommand's `--help` now runs without panic in a debug build.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Extract tapp-cli from tapp-service into its own workspace member crate,
decoupled from TEE attestation dependencies (attestation-agent, bollard,
ecies, ring, sysinfo, psutil) that prevent compilation on macOS.

Changes:
- Add tapp-cli/ as a workspace member with minimal Cargo.toml
- Pre-generate proto Rust code (src/proto_gen.rs) to eliminate
  build-time protoc dependency
- Copy only needed modules: onchain, app_key (sign/verify), error
- Strip app_key to sign_message/verify_signature only
- Remove tapp-cli binary target from tapp-service Cargo.toml
- Include fix/cli-short-flag-collisions changes

The standalone crate compiles on macOS with only:
  cargo build --release
No protoc, OpenSSL, or Docker needed.
@Wilbert957

Copy link
Copy Markdown
Collaborator Author

Closing in favor of the shared-crate SDK approach (#9, design in #15).

Why: this PR extracts the CLI by copying modules (cli.rstapp-cli/src/main.rs, plus onchain/app_key/error) and pre-generating the proto snapshot. Since it was opened, main has moved a lot (#8 per-node compose, #10 list-apps, #11 -s fix, #12 verify-app), so this branch's copy is now stale — it lacks list-apps/verify-app, the ListApps RPC + attestation proto, and the new onchain reads / AS client — and the copy approach would need re-syncing on every future CLI change.

The macOS-buildability goal is still wanted; we'll get it the cleaner way: extract verify + onchain + app_key(sign/verify) + error + proto into a single TEE-dependency-free shared crate that both tapp-service and a thin tapp-cli depend on — macOS-buildable, zero duplication, and it picks up list-apps/verify-app automatically since they already live in those modules. Tracked in #9 / #15.

@Wilbert957 Wilbert957 closed this Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant