Skip to content

feat: add cougr-cli with cougr add command - #270

Open
mrteeednut007-dotcom wants to merge 2 commits into
salazarsebas:mainfrom
mrteeednut007-dotcom:feat/cougr-add-command
Open

feat: add cougr-cli with cougr add command#270
mrteeednut007-dotcom wants to merge 2 commits into
salazarsebas:mainfrom
mrteeednut007-dotcom:feat/cougr-add-command

Conversation

@mrteeednut007-dotcom

Copy link
Copy Markdown

feat: cougr add — shadcn-style piece distribution for Cougr projects

Implements cougr add as described in docs/strategy/06-product-strategy.md. Adds a new cougr-cli
workspace member (binary crate, cargo install cougr-cli) that copies named, self-contained
pieces from the example catalog into a user's project as owned, editable source — no opaque
dependency, no manual copy-paste.

What was added

cougr-cli/ — new binary crate wired into the workspace

cougr add --list — prints all available pieces with one-line descriptions and maturity tiers:

session-auth [beta ] Session-key auth: approve once, play frictionlessly...
hidden-hand [experimental] Hidden-card ZK proof flow: init a table, verify deal
proofs...
standards/pausable [stable ] Emergency pause/unpause guard backed by persistent
storage...

cougr add — copies piece files into src/, appends pub mod declarations to lib.rs, and
prints exactly what was written.

Conflict handling — if a target file already exists, the command refuses to overwrite it,
prints the full verbatim content that would have been written (so the user can diff manually),
and exits non-zero. Running cougr add twice never silently clobbers local edits.

Pieces shipped in v1

All piece source is embedded in the binary at compile time via include_str!("../pieces.toml") —
no runtime network calls, no remote registry.

┌──────────────┬──────────┬────────┐
│ Piece │ Maturity │ Source │
├──────────────┼──────────────┼─────────────────────────────────────────────────────────────┤
│ session-auth │ Beta │ examples/session_arena — SessionManager lifecycle (approve │
│ │ │ → tap → renew → fallback) │
├────────────────────┼──────────────┼───────────────────────────────────────────────────────┤
│ hidden-hand │ Experimental │ examples/hidden_hand — init_table / verify_deal via │
│ │ │ circuits::hidden_cards │
├────────────────────┼──────────────┼───────────────────────────────────────────────────────┤
│ standards/pausable │ Stable │ src/standards/pausable.rs — ContractPausable newtype │
│ │ │ over cougr_core::ops::Pausable │
└────────────────────┴──────────────┴───────────────────────────────────────────────────────┘

Testing

11 unit and integration tests, all passing (cargo test -p cougr-cli). Tests cover: file
creation for each piece, lib.rs mod wiring, double-add conflict detection, unknown piece error
messaging, and missing src/ directory detection.

Definition of done

  • cougr add --list shows 3 pieces
  • cougr add session-auth on a fresh project writes files and updates lib.rs without errors
  • Running cougr add twice for the same piece refuses to overwrite and shows a preview

closes #245

Implements the shadcn-style piece distribution pattern described in
docs/strategy/06-product-strategy.md.

- New cougr-cli workspace member (binary crate, cargo install cougr-cli)
- cougr add --list  — prints all available pieces with maturity tiers
- cougr add <piece> — copies a named piece into src/ as owned, editable source
- Conflict detection: refuses to overwrite existing files, shows preview
- Automatic mod declaration wiring into lib.rs (idempotent)

Pieces shipped in v1 (embedded in binary via pieces.toml):
  session-auth        [beta]         SessionManager lifecycle from session_arena
  hidden-hand         [experimental] hidden_cards ZK circuit from hidden_hand
  standards/pausable  [stable]       Pausable guard from src/standards/pausable.rs

11 unit/integration tests, all passing.
@drips-wave

drips-wave Bot commented Jul 25, 2026

Copy link
Copy Markdown

@mrteeednut007-dotcom Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@salazarsebas

Copy link
Copy Markdown
Owner

Solid implementation of #245. It currently lives at cougr-cli/ (repo root); once #288 merges and fixes cli/ as the canonical location for the CLI crate, could you move this there and rebase before we merge?

@salazarsebas

Copy link
Copy Markdown
Owner

This looks like a solid cougr add implementation, but it's built as a standalone cougr-cli/ crate rather than extending the cli/ crate that's already on main (which has cougr new working). Could you rebase onto main and add the add subcommand there instead, so we don't end up with two competing CLI crates? Let me know if you'd like pointers on the existing cli/ structure.

@mrteeednut007-dotcom

Copy link
Copy Markdown
Author

fixed check

@mrteeednut007-dotcom

Copy link
Copy Markdown
Author

drop points please

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.

feat(cli): implement 'cougr add <piece>' component/system importer

2 participants