PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: nats-io/nsc (go)

Issue:
Add flag to set the account server url for `nsc push`
This would avoid having to hardcode an ip into the jwt when pushing or modifying /etc/hosts to the public ip in case the machine has not been deployed yet.

Instead of

```sh
nsc edit operator --account-jwt-server-url http://127.0.0.1:9090/jwt/v1/
nsc edit operator --account-jwt-server-url http://external-nats-account-server:9090/jwt/v1/ 
nsc push -A
```

Do for example:

```
nsc push -A --account-jwt-server-url http://127.0.0.1:9090/jwt/v1/
nsc push -A --account-jwt-server-url http://external-nats-account-server:9090/jwt/v1/ 
```

Pull request:
FIX #263 Added ability to specify --account-jwt-server-url flag when pushing

Patch:
diff --git a/cmd/importkeys.go b/cmd/importkeys.go
index ee671c7..ace1dea 100644
--- a/cmd/importkeys.go
+++ b/cmd/importkeys.go
@@ -44,7 +44,7 @@ nsc import keys --recursive --dir <path>
 			return nil
 		},
 	}
-	cmd.Flags().StringVarP(&params.Dir, "dir", "d", "", "directory to export keys to")
+	cmd.Flags().StringVarP(&params.Dir, "dir", "d", "", "directory to import keys from")
 	cmd.Flags().BoolVarP(&params.Recurse, "recurse", "R", false, "recurse directories")
 	cmd.MarkFlagRequired("dir")
 
diff --git a/cmd/push.go b/cmd/push.go
index 014abdd..29cf2b6 100644
--- a/cmd/push.go
+++ b/cmd/push.go
@@ -42,6 +42,7 @@ push -A (all accounts)`,
 	}
 	cmd.Flags().BoolVarP(&params.allAccounts, "all", "A", false, "push all accounts under the current operator (exclusive of -a)")
 	cmd.Flags().BoolVarP(&params.force, "force", "F", false, "push regardless of validation issues")
+	cmd.Flags().StringVarP(&params.ASU, "account-jwt-server-url", "u", "", "set account jwt server url for nsc sync (only http/https urls supported if updating with nsc)")
 	params.AccountContextParams.BindFlags(cmd)
 	return cmd
 }


Test patch:
diff --git a/cmd/push_test.go b/cmd/push_test.go
index 54be93d..2545d2e 100644
--- a/cmd/push_test.go
+++ b/cmd/push_test.go
@@ -16,6 +16,7 @@
 package cmd
 
 import (
+	"github.com/nats-io/jwt"
 	"runtime"
 	"testing"
 
@@ -94,3 +95,35 @@ func Test_SyncManaged(t *testing.T) {
 	require.NoError(t, err)
 	require.False(t, ac.IsSelfSigned())
 }
+
+func Test_SyncManualServer(t *testing.T) {
+	_, _, okp := CreateOperatorKey(t)
+	as, m := RunTestAccountServerWithOperatorKP(t, okp)
+	defer as.Close()
+
+	// remove the account server
+	op, err := jwt.DecodeOperatorClaims(string(m["operator"]))
+	require.NoError(t, err)
+	op.AccountServerURL = ""
+	s, err := op.Encode(okp)
+	require.NoError(t, err)
+	m["operator"] = []byte(s)
+
+	ts := NewTestStoreWithOperator(t, "T", okp)
+	err = ts.Store.StoreRaw(m["operator"])
+	require.NoError(t, err)
+	ts.AddAccount(t, "A")
+
+	// edit the jwt
+	_, _, err = ExecuteCmd(createEditAccount(), "--tag", "A")
+	require.NoError(t, err)
+
+	// sync the store
+	_, _, err = ExecuteCmd(createPushCmd(), "--account", "A", "--account-jwt-server-url", as.URL)
+	require.NoError(t, err)
+
+	// verify the tag was stored
+	ac, err := ts.Store.ReadAccountClaim("A")
+	require.NoError(t, err)
+	require.Contains(t, ac.Tags, "a")
+}