From 1583a5f5b137ec408d9358c12f6716f7033a2c69 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 20 Feb 2026 12:08:37 +0000 Subject: improve ngit init messaging for co-maintainership acceptance when a co-maintainer runs ngit init, it now clearly states upfront that they are accepting a co-maintainership offer (not creating a new repo), shows who offered it, and on completion confirms the acceptance and explains they can now push. updating an existing co-maintainer announcement also gets its own clear message. --- src/bin/ngit/sub_commands/init.rs | 55 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs index 5dd6157..39c8e8e 100644 --- a/src/bin/ngit/sub_commands/init.rs +++ b/src/bin/ngit/sub_commands/init.rs @@ -1231,7 +1231,7 @@ fn prompt_git_servers( } } -#[allow(clippy::too_many_lines)] +#[allow(clippy::too_many_lines, clippy::too_many_arguments)] async fn publish_and_finalize( fields: ResolvedFields, signer: Arc, @@ -1240,6 +1240,7 @@ async fn publish_and_finalize( cli: &Cli, git_repo: &Repo, repo_config_result: &Result, + is_co_maintainer_first_acceptance: bool, ) -> Result<()> { let git_repo_path = git_repo.get_path()?; @@ -1432,12 +1433,22 @@ async fn publish_and_finalize( } } - // Step 9: Print share URLs + // Step 9: Print share URLs / completion message let gitworkshop_url = nostr_url_decoded .to_string() .replace("nostr://", "https://gitworkshop.dev/"); - println!("share your repository: {gitworkshop_url}"); - println!("clone url: {nostr_url}"); + if is_co_maintainer_first_acceptance { + println!("co-maintainership accepted."); + println!("your announcement was published to nostr. you can now push updates."); + println!("your repository URL: {gitworkshop_url}"); + println!("your clone URL: {nostr_url}"); + println!( + "note: run `ngit init` at any time to update your announcement (relays, git servers, etc.)" + ); + } else { + println!("share your repository: {gitworkshop_url}"); + println!("clone url: {nostr_url}"); + } // Step 10: Update maintainers.yaml if needed let relays = fields @@ -1552,6 +1563,41 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { validate_post_fetch(cli_args, args, &state)?; + // Print CoMaintainer-specific context before proceeding so the user + // understands they are accepting (or updating) a co-maintainership + // offer, NOT creating a new repository. + let is_co_maintainer_first_acceptance = + if let InitState::CoMaintainer { repo_ref: rr, .. } = &state { + rr.maintainers_without_annoucnement + .as_ref() + .is_some_and(|ms| ms.contains(&user_ref.public_key)) + } else { + false + }; + + if let InitState::CoMaintainer { repo_ref: rr, .. } = &state { + if is_co_maintainer_first_acceptance { + println!( + "accepting co-maintainership of '{}' (offered by {})", + rr.name, + rr.trusted_maintainer + .to_bech32() + .unwrap_or_else(|_| rr.trusted_maintainer.to_string()), + ); + println!( + "publishing your repository announcement to nostr to confirm your co-maintainership..." + ); + if cli_args.interactive { + println!("tip: run `ngit init -d` to accept with defaults and skip all prompts"); + } + } else { + println!( + "updating your co-maintainer announcement for '{}' on nostr...", + rr.name + ); + } + } + // Phase 5: Resolve all fields let repo_config_result = get_repo_config_from_yaml(&git_repo); let fields = resolve_fields( @@ -1575,6 +1621,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { cli_args, &git_repo, &repo_config_result, + is_co_maintainer_first_acceptance, ) .await } -- cgit v1.2.3