From 09bb21462ac5571cace5a7e71103156772a499fe Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Tue, 10 Feb 2026 12:52:19 +0000 Subject: feat: update ngit init for non-interactive mode Complete rewrite of ngit init to support non-interactive mode by default. Key changes: - Implement hybrid validation (validate all args upfront, fail fast) - Add --grasp-servers flag for specifying git servers - Prefer --name over --identifier for better UX - Add comprehensive validation with helpful error messages - Support both clone and init-from-existing-repo workflows - Add --force flag to bypass safety checks - Update tests for new non-interactive behavior - Add test utilities for non-interactive testing --- test_utils/src/git.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test_utils/src/git.rs') diff --git a/test_utils/src/git.rs b/test_utils/src/git.rs index ab21f38..a18f81c 100644 --- a/test_utils/src/git.rs +++ b/test_utils/src/git.rs @@ -282,6 +282,30 @@ impl GitTestRepo { branch.set_upstream(Some(&format!("origin/{branch_name}")))?; self.checkout(branch_name) } + + /// Set nostr.repo git config to point to a specific pubkey's coordinate. + /// Used for State D/E tests where the coordinate points to another user. + pub fn set_nostr_repo_coordinate( + &self, + pubkey: &nostr::PublicKey, + identifier: &str, + relays: &[&str], + ) { + let relay_urls: Vec = relays + .iter() + .map(|r| nostr::RelayUrl::parse(r).unwrap()) + .collect(); + let coordinate = Nip19Coordinate { + coordinate: Coordinate::new(nostr::Kind::GitRepoAnnouncement, *pubkey) + .identifier(identifier.to_string()), + relays: relay_urls, + }; + let _ = self + .git_repo + .config() + .unwrap() + .set_str("nostr.repo", &coordinate.to_bech32().unwrap()); + } } impl Drop for GitTestRepo { -- cgit v1.2.3