Skip to content

Commit b86338d

Browse files
alnrory-bot
authored andcommitted
chore: separate API-only CLI packages from server code
GitOrigin-RevId: 52bf0fb46dd46fa26c666d2c769c0dc8a518927c
1 parent 4a19b80 commit b86338d

23 files changed

Lines changed: 75 additions & 68 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright © 2023 Ory Corp
22
// SPDX-License-Identifier: Apache-2.0
33

4-
package cliclient
4+
package cleanup
55

66
import (
77
"github.com/pkg/errors"

cmd/cleanup/sql.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313

1414
"github.com/ory/kratos/driver/config"
1515

16-
"github.com/ory/kratos/cmd/cliclient"
1716
"github.com/ory/x/configx"
1817
)
1918

@@ -32,7 +31,7 @@ You can read in the database URL using the -e flag, for example:
3231
Before running this command on an existing database, create a back up!
3332
`,
3433
RunE: func(cmd *cobra.Command, args []string) error {
35-
err := cliclient.NewCleanupHandler().CleanupSQL(cmd, args)
34+
err := NewCleanupHandler().CleanupSQL(cmd, args)
3635
if err != nil {
3736
_, _ = fmt.Fprintln(cmd.OutOrStdout(), err)
3837
return cmdx.FailSilently(cmd)

cmd/identities/get.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"fmt"
88

99
kratos "github.com/ory/kratos/pkg/httpclient"
10-
"github.com/ory/kratos/x"
1110
"github.com/ory/x/cmdx"
1211
"github.com/ory/x/stringsx"
1312

@@ -87,7 +86,7 @@ To get an identity by its external ID, run:
8786
Execute()
8887
}
8988

90-
if x.SDKError(err) != nil {
89+
if clihelpers.SDKError(err) != nil {
9190
failed[id] = cmdx.PrintOpenAPIError(cmd, err)
9291
continue
9392
}

cmd/identities/list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
"github.com/ory/x/flagx"
1212

13-
"github.com/ory/x/pagination/keysetpagination"
13+
"github.com/ory/x/pagination/keysetclient"
1414

1515
"github.com/ory/kratos/cmd/cliclient"
1616
"github.com/ory/x/cmdx"
@@ -65,7 +65,7 @@ Eventual consistency means that the list operation will return faster and might
6565
return cmdx.PrintOpenAPIError(cmd, err)
6666
}
6767

68-
pages := keysetpagination.ParseHeader(res)
68+
pages := keysetclient.ParseHeader(res)
6969
cmdx.PrintTable(cmd, &outputIdentityCollection{
7070
Identities: identities,
7171
NextPageToken: pages.NextToken,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright © 2023 Ory Corp
22
// SPDX-License-Identifier: Apache-2.0
33

4-
package cliclient
4+
package migrate
55

66
import (
77
"fmt"

cmd/migrate/normalize_phone.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99

1010
"github.com/spf13/cobra"
1111

12-
"github.com/ory/kratos/cmd/cliclient"
1312
"github.com/ory/kratos/driver"
1413
"github.com/ory/x/configx"
1514
)
@@ -36,7 +35,7 @@ You can read in the database URL using the -e flag, for example:
3635
Before running this command on an existing database, create a back up!
3736
`,
3837
RunE: func(cmd *cobra.Command, args []string) error {
39-
err := cliclient.NewNormalizePhoneHandler().NormalizePhoneNumbers(cmd, args, opts...)
38+
err := NewNormalizePhoneHandler().NormalizePhoneNumbers(cmd, args, opts...)
4039
if err != nil {
4140
_, _ = fmt.Fprintln(cmd.ErrOrStderr(), err)
4241
return err
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright © 2026 Ory Corp
22
// SPDX-License-Identifier: Apache-2.0
33

4-
package cliclient
4+
package migrate
55

66
import (
77
"fmt"

cmd/cliclient/normalize_phone_test.go renamed to cmd/migrate/normalize_phone_handler_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright © 2026 Ory Corp
22
// SPDX-License-Identifier: Apache-2.0
33

4-
package cliclient
4+
package migrate
55

66
import (
77
"testing"

cmd/migrate/root.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package migrate
66
import (
77
"github.com/spf13/cobra"
88

9-
"github.com/ory/kratos/cmd/cliclient"
109
"github.com/ory/kratos/driver"
1110
"github.com/ory/x/configx"
1211
"github.com/ory/x/popx"
@@ -31,18 +30,18 @@ func RegisterCommandRecursive(parent *cobra.Command) {
3130

3231
func NewMigrateSQLDownCmd(opts ...driver.RegistryOption) *cobra.Command {
3332
return popx.NewMigrateSQLDownCmd(func(cmd *cobra.Command, args []string) error {
34-
return cliclient.NewMigrateHandler().MigrateSQLDown(cmd, args, opts...)
33+
return NewMigrateHandler().MigrateSQLDown(cmd, args, opts...)
3534
})
3635
}
3736

3837
func NewMigrateSQLUpCmd(opts ...driver.RegistryOption) *cobra.Command {
3938
return popx.NewMigrateSQLUpCmd(func(cmd *cobra.Command, args []string) error {
40-
return cliclient.NewMigrateHandler().MigrateSQLUp(cmd, args, opts...)
39+
return NewMigrateHandler().MigrateSQLUp(cmd, args, opts...)
4140
})
4241
}
4342

4443
func NewMigrateSQLStatusCmd(opts ...driver.RegistryOption) *cobra.Command {
4544
return popx.NewMigrateSQLStatusCmd(func(cmd *cobra.Command, args []string) error {
46-
return cliclient.NewMigrateHandler().MigrateSQLStatus(cmd, args, opts...)
45+
return NewMigrateHandler().MigrateSQLStatus(cmd, args, opts...)
4746
})
4847
}

cmd/migrate/sql.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package migrate
66
import (
77
"github.com/spf13/cobra"
88

9-
"github.com/ory/kratos/cmd/cliclient"
109
"github.com/ory/kratos/driver"
1110
"github.com/ory/x/configx"
1211
)
@@ -30,7 +29,7 @@ You can read in the database URL using the -e flag, for example:
3029
Before running this command on an existing database, create a back up!
3130
`,
3231
RunE: func(cmd *cobra.Command, args []string) error {
33-
return cliclient.NewMigrateHandler().MigrateSQLUp(cmd, args, opts...)
32+
return NewMigrateHandler().MigrateSQLUp(cmd, args, opts...)
3433
},
3534
}
3635

0 commit comments

Comments
 (0)